I want the form's onsubmit handler to be called,but don't want to submit the form.
Is this possible with jQuery?
I want the form's onsubmit handler to be called,but don't want to submit the form.
Is this possible with jQuery?
Yes it is. I would recommend stopping the default action of the event from being triggered, like this:
$("#myForm").submit(function(e) {
e.preventDefault();
});
See http://api.jquery.com/event.preventDefault/
You can also use return false
at the end of the event handler. These two methods, however, are not exactly equivalent, so it is important to understand their differences.