php - Button Click does not work after executing Ajax function -
this question exact duplicate of:
i have readmore
button generated ajax , using below code execute click event button, nothing happens.
the button when clicked should unhide div dynamic , generated ajax. dynamic content dealing ideas please. thanks.
jquery:
jquery(document).on('click', '#readmore', function(e){ e.preventdefault(); alert("you clicked button"); jquery("#bodytext").css("display", "block"); });
you have 2 options make work,
- convert button hyperlink
e.preventdefault
prevent click of button default behavior. - remove
e.preventdefault()
code.
also make sure have included latest version of jquery. , write code in $.ready() like,
$(function(){ // code here });
now, try use 1 option above.
Comments
Post a Comment