Affect the HTML code inserted by jQuery on runtime - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:html

Description

Affect the HTML code inserted by jQuery on runtime

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.11.0.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/* ww w  . ja va  2  s.  co m*/
for (var i = 0; i < 50; i++) {
 $("#wrapper").append("<div class='common'><br>hello<br></div>");
}
$("#wrapper").on("click", "div.common", function() {
    console.log('clicked');
});
    });

      </script> 
 </head> 
 <body> 
  <div id="wrapper"></div>  
 </body>
</html>

Related Tutorials