I load content to my popup with jQuery Ajax load function and I use submit function in load functions callback function, but for some reason event is not fired at all. (I use jQuery jquery-1.3.2.min.js)
$('.popup-container').load(url, function(){
/** Do some stuff here */
$("form").submit(function() {
alert("Form submitted!");
return false;
});
});
Update
As of jQuery 1.7, the
.live()method is deprecated. It will be removed in jQuery 1.9. Use.on()to attach event handlers. Users of older versions of jQuery should use.delegate()in preference to.live().Original Answer
You can fix this by using the jQuery method
live(). Usinglive()withsubmit()has been added to jQuery 1.4 so you should get an update. Here is a video tutorial on usinglive()withsubmit().When using the live function your code should look like this: