The following snippet disables the submit button of all forms in scope of the function after the submit button has been initially clicked. To prevent users from submitting your forms more than once.
|
1 2 3 4 5 |
$('form').submit(function(){ $(':submit', this).click(function() { return false; }); }); |
How does it work?
When the submit button of the form is clicked, it triggers the form submit function of jquery, then takes the submit handler of the current form and makes it return false so it can’t submit the same form again.