I'm having a problem with jQuery 1.7's latest on()
function. I'm moving all of my existing live()
calls to the new on()
function.
In the past I used live()
whenever I created a new element or appended some markup from AJAX.
With jQuery 1.7 If I append form markup returned via AJAX and try to use e.preventDefault
or return false
to stop it from submitting (to validate it for example) — the form is submitted as normal.
$(document).on('submit', 'form', function(e) {
alert('You tried to submit the form');
e.preventDefault();
});