Register event for inner element - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:on

Description

Register event for inner element

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-1.8.3.js"></script> 
  <script type="text/javascript">
    $(function(){/* www.j a  v  a 2s. c o m*/
$(document).on('click', '.test a', function(e){
    console.log("hello world");
});
    });

      </script> 
 </head> 
 <body> 
  <p> <a href="javascript:void(0);" class="test">Test Link 1</a> </p> 
  <p class="test"> <a href="#">Test Link 2</a> </p>  
 </body>
</html>

Related Tutorials