last selector
Description: Selects the last matched element.
jQuery(':last')
version added: 1.0
Note that :last selects a single element by filtering the current jQuery collection and matching the last element within it.
Examples
Finds the last table row.$("tr:last").css({backgroundColor: 'yellow', fontWeight: 'bolder'});
Full source:
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function(){ $("tr:last").css({backgroundColor: 'yellow', fontWeight: 'bolder'}); }); </script> </head> <body> <table> <tr><td>First Row</td></tr> <tr><td>Middle Row</td></tr> <tr><td>Last Row</td></tr> </table> </body> </html>
Was this information helpful?

