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
Related posts:
- Disable the TRACE and TRACK For More Security
- Send Email to Multiple Persons using php
- Simple PHP mail Script
- Load Another Webpage Content Using Simple Jquery
- View webpage source using javascript
- Expand and collapse toggle div using jquery
- Jquery Basics, How to use jquery?
