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

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -