This post will discuss how to disable the submit button on form submission with JavaScript and jQuery. A button is called disabled if it can’t be selected, clicked on, or accept focus.

The idea is to use the disabled HTML attribute to disable a submit button on its click.

JS


HTML


CSS



Edit in JSFiddle

 
With jQuery, you can use the .prop() method to disable the submit button.

JS


HTML


CSS



Edit in JSFiddle

 
Instead of attaching a click event handler to the form submit button, we should handle this in the submit event. The submit event fires whenever the user submits a form.

JS


HTML


CSS



Edit in JSFiddle

 
Alternatively, you can disable the submit button using the onsubmit property in the HTML <form> element.

HTML


JS


CSS



Edit in JSFiddle

That’s all about disabling submit button on form submission in JavaScript and jQuery.