Javascript examples for jQuery Method and Property:on
Add event to new added element in jQuery
<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"> $(window).load(function(){/*from w ww.j a v a2s . c o m*/ $('a').on('click', function() { var newel = '<input type="text" />'; $(newel).on("focus",function() { console.log("hello")}).insertAfter($('a')); }); }); </script> </head> <body> <a href="#">ee</a> </body> </html>