last
英[lɑ:st] 美[læst]
n.last;end;last;shoe last (model for making shoes)
vt. Withstand; after...; enough; enough to maintain (especially for a certain period of time)
adj. The last; the nearest; the least likely; the only remaining one
vi.Continue
adv.Last; last time, most recent time
jquery last() method syntax
Function: last() reduces the set of matching elements to the last element in the set.
Syntax: .last()
Description: If a jQuery object representing a collection of DOM elements is given, .last( ) method will construct a new jQuery object with the last matching element.
jquery last() method example
<!DOCTYPE html> <html> <head> <style>.highlight{background-color: yellow}</style> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> </head> <body> <p><span>Look:</span> <span>This is some text in a paragraph.</span> <span>This is a note about it.</span></p> <script>$("p span").last().addClass('highlight');</script> </body> </html>
Click the "Run instance" button to view the online instance