Facebook Twitter Reset

This Tutorial Has Been Viewed 2,169 Times.

Disable submit button on form submit

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

VN:F [1.9.13_1145]
Rating: 7.3/10 (4 votes cast)
VN:F [1.9.13_1145]
Rating: -1 (from 1 vote)
Disable submit button on form submit, 7.3 out of 10 based on 4 ratings

Incoming search terms:




You will also be interested in ,

No comments yet.

Leave a Comment

Spam protection by WP Captcha-Free

Affordable Seo PackagesSeo BlogEdu Backlinks
More in Css, scripts (85 of 94 articles)