Disable submit button on form submit
Posted by admin | Posted in Jquery | Posted on 07-12-2009
0
Multiple form submission is one of the issues that a webmaster face during his development.So instead of writing a hardcore code in the server side.We can just validate a multiple submission using simple client side Jquery.
Consider we have this HTML form in our code:
<form id="check" action="someUrl.php" method="get"> <input name="username" /> <!-- some more form fields --> <input id="submit" type="submit" /> </form>
Here is a jQuery code that disables submit button on form submission:
$('#check').submit(function(){ $('input[type=submit]', this).attr('disabled', 'disabled'); });
The above jQuery code binds a submit event to our #check form, then finds its submit button and disables it.
Disable submit button on form submission for all forms on your page.
// Find ALL <form> tags on your page $('form').submit(function(){ // On submit disable its submit button $('input[type=submit]', this).attr('disabled', 'disabled'); }); Thanks HOW TO JQUERY
Related posts:












