On form submit disable submit button

jQuery code that disables submit button on form submission:

$('#myform').submit(function(){
    $('input[type=submit]', this).attr('disabled', 'disabled');
});
JavaScript provides an easy way to disable the multiple submission of a form.
<form name="myform" action="/" method="post"
onsubmit="document.getElementById('submit_button').disabled = 1;">
 </form>
Share this nice post:

One thought on “On form submit disable submit button

Leave a Reply

Your email address will not be published. Required fields are marked *