Monday, 15 October 2012

Disable submit button after clicked with jQuery

In Web development, the most common issue is the double same form submission. Often times, users like to press few time on the submit button to make sure the button is surely clicked, and causing the double form submission issue.
The common solution is disabled the submit button after user clicked on it, and display a loading or submitting message to show user the form is on the progress. 

Disable Submit Button:

To disable the submit button with jQuery, you just need to add a “disabled” attribute to the submit button.
 $('p').text("Form submiting.....");
 $('input:submit').attr("disabled", true); 

Enable submit button

To enable back the disabled submit button, set the “disabled” attribute to false, or remove the “disabled” attribute.

$('input:submit').attr("disabled", false); 
Please refer following link for further information....
Click Here

No comments:

Post a Comment