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
Post a Comment