jQuery is 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(){ $( "ul" ).on( "click", function(event) { var target = $(event.target); if(target.is("li")){ $(target).css("border","4px solid red"); } if(target.is("span")){ $(target).css("background","yellow"); } }); }); </script> </head> <body> <h4>Click on below Elements</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><span>Third Item (Index 2) with span</span></li> <li><span>Fourth Item (Index 3) with span</span></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(){ $( "ul" ).on( "click", function(event) { var target = $(event.target); if(target.is("li")){ $(target).css("border","4px solid red"); } if(target.is("span")){ $(target).css("background","yellow"); } }); }); </script> </head> <body> <h4>Click on below Elements</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><span>Third Item (Index 2) with span</span></li> <li><span>Fourth Item (Index 3) with span</span></li> </ul> </body> </html>
Copyrights@tutorialsplane.com