Skip to content Skip to sidebar Skip to footer

Bind An Event Handler On A Element Who's Inserted By The JQuery .html() Function

I render some new content with .html() after ajax call into my site. $.getJSON(scriptURL, $('#domainForm').serialize(), function(data) { $('#checkedDomain').html(data['html'])

Solution 1:

Try using jQuery.live()


As of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers. Users of older versions of jQuery should use .delegate() in preference to .live().


Solution 2:

$("#tagWithHandlerOn").live(event,handler) might just do the trick


Post a Comment for "Bind An Event Handler On A Element Who's Inserted By The JQuery .html() Function"