Stopping the dreaded double-form submission with jQuery
posted by Ted on
When developing forms, we web developers always have to guard against the dreaded double-form submit, when impatient (or even patient) users, depending on the latency of form submissions, hit the “submit” or “enter” button multiple times, causing havoc to the application.
Using the jQuery javascript library, preventing this on the client side is actually pretty easy. First, make sure you have jQuery included in your app. Then, use this code:
$("form").submit(function() { $(":submit",this).attr("disabled", "disabled"); });