javascript - Apply Jquery to generated content -


hoping can point me in right direction.

i've got code:

//nextbutton processing     $('.nextbutton').on("click", function(){     //$('.nextbutton').click(function(){           var querystring = $("#formstep").serialize() + "&step=" + step + "&session=" + session;         // ajax call         $.ajax({                 type: "post",                 data: querystring,                 url: "includes/processnext.php",                 datatype: 'json',                 success: function(msg){                     $('.result').append(msg.answerrow);                  }             });    // end ajax call     }); 

now works first .nextbutton on there, ajax result replaces next next button.

to fix tried using jquery .on() (old code commented out) doesn't seem have solved either.

any suggestions?

thanks.

attach click event handler container element, this:

$('#container').on("click", ".nextbutton", function(){ 

the container element "catch" click event bubbles .nextbutton.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -