javascript - Button click event on $.post-loaded button -


after filling div $(mydiv).load() call, want catch click event on button inside div.

now reason $('.mybutton').click not invoked when click on button loaded through jquery's load function.

what best way around this?

you have catch event of dynamic object, have use .on() try this:

$(document).on('click', '.mybutton', function(){   //your code }); 

instead of

$('.mybutton').click(function(){   //your code }); 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -