jQuery last selector
Description and Syntax
$(':last)
selects the last element within the matched set.
Examples
$('li:last)
selects the last<li>
element$('.myclass:last)
selects the last element with the classmyclass
The following code selects the last row.
<html>
<head>
<script src="http://java2s.com/style/jquery-1.8.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){<!--from www .ja v a 2 s . c om-->
$("tr:last").css({backgroundColor: 'yellow', fontWeight: 'bolder'});
});
</script>
</head>
<body>
<body>
<table>
<tr><td>First</td></tr>
<tr><td>Middle</td></tr>
<tr><td>Last</td></tr>
</table>
</body>
</html>