I want to prevent multiple submit if someone click on one of the submit buttons multiple times.
How can unbind
or undelgate
in this case th
Bind and unbind are deprecated in JQuery.
As of jQuery 1.7, the .on()
method is the preferred method for attaching event handlers to a document.
http://api.jquery.com/on/
To answer your question about multiple submits, another new addition in JQuery 1.7 is the .one()
handler which, attaches an event handler to an object but only allows it to be fired once. This will allow you to prevent multiple submits.
e.g:
$("form#form1").one("submit", submitFormFunction);
function submitFormFunction(event) {
event.preventDefault();
$("form#form1").submit();
}
Note I'm binding to the form submit event rather than a button click event.