jQuery last method
jQuery “last()” method is used to get the last element of the selected elements.
Syntax : jQuery last() method
$(selector).last();
Note : It accepts no parameter.
jQuery last method Example
jQuery last() Method with Syntax
<script type="text/javascript"> $(document).ready(function(){ $( "a" ).on( "click", function(event) { $("li").last().css("background","yellow"); }); }); </script> |
Advertisements