Javascript examples for jQuery:Mouse Event
Click to add element and then add event to the new added element
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script> <script type="text/javascript"> $(function(){// www .ja v a 2s . co m $("button").on("click",function(){ $("body").append("<div>delegatin</div>"); console.log("normal"); }); $("body").on("click","div",function(){ console.log("delegation"); }); }); </script> </head> <body> <buton> on normal click <button> </button> </buton> </body> </html>