Click on ul > li - Javascript jQuery

Javascript examples for jQuery:Mouse Event

Description

Click on ul > li

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.0.js"></script> 
   </head> 
   <body> 
      <ul id="my"> 
         <li>Click me1</li> 
         <li>Click me2</li> 
         <li>Click me3</li> 
      </ul> 
      <script type="text/javascript">
$("#my").on("click", "li", function(){
    console.log("I work");
});/*ww  w .j av a 2 s. co  m*/

      </script>  
   </body>
</html>

Related Tutorials