The live() method is great if you want to associate an element with an event, but which event would you use to keep the plugin stable? I don’t think there is one ...
Instead, you can put the plugin’s initial binding into a function, and then call that function after you have created the ajax div, like this:
function setPlugins() { $('#abc').myPlugin(); } $.ajax({ type: "POST", url: "some.php", data: "name=John&location=Boston", success: function(msg){ setPlugins(); } });
I'm not quite sure that this is the best way to solve your problem, but that is how I do it.
source share