jQuery last method
home
Run
screen_rotation
fullscreen
cloud_download
<!DOCTYPE html> <html> <head> <title>jQuery Demo example</title> <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ $( "a" ).on( "click", function(event) { $("li").last().css("background","yellow"); }); }); </script> </head> <body> <h4><a href="javascript:void(0);">Click Me to select last "li" element</a></h4> <ul style="cursor:pointer;"> <li>First Item (Index 0)</li> <li class="second-li">Second Item ( Second li) <ul> <li> Sub li 1</li> <li>Sub li 2</li> <li>Sub li 3</li> <li>Sub li 4</li> </ul> </li> <li>Third Item (Index 2) </span></li> <li>Fourth Item (Index 3)</li> </ul> </body> </html>
<!DOCTYPE html> <html> <head> <title>jQuery Demo example</title> <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"> </script> <script type="text/javascript"> $(document).ready(function(){ $( "a" ).on( "click", function(event) { $("li").last().css("background","yellow"); }); }); </script> </head> <body> <h4><a href="javascript:void(0);">Click Me to select last "li" element</a></h4> <ul style="cursor:pointer;"> <li>First Item (Index 0)</li> <li class="second-li">Second Item ( Second li) <ul> <li> Sub li 1</li> <li>Sub li 2</li> <li>Sub li 3</li> <li>Sub li 4</li> </ul> </li> <li>Third Item (Index 2) </span></li> <li>Fourth Item (Index 3)</li> </ul> </body> </html>
Copyrights@tutorialsplane.com