Looking to Build/Redesign a Website or Blog ?

To speak to Rakshit, call +91 968 704 2303

Disable submit button with jQuery

Hello Friends,

Form submission is one of the most frequently used actions in developing web application. If form submit two times than it will create lots of problems so you must take care about submitting form. One of the way is to restrict user by disabling the submit button using jQuery once form submit.

<form id="frm" action="index.php" method="post">

    <input name="name" id="name" />

    <input name="email" id="email" />

    <input id="submit" type="submit" />

</form>

Below is a jQuery code to disable submit button once form submitted:

$('#frm').submit(function(){

    $('input[type=submit]', this).attr('disabled', 'disabled');

});

//If you want to disable all forms' submit button than below is the code.

$('form').submit(function(){

    $('input[type=submit]', this).attr('disabled', 'disabled');

});

 

If you find any problem in this than let me know by comment.

To know more about programming,JavaScript issues,jQuery,Expression Engine,MYSQL database and Open-source, enter your email address below. We will send you free tutorials.

Enter your email address:
 
Feel free to ask any question. Just leave your comment below and we will answer your comment with in 24 hours.
Share:

2 Comments

  • Agree with Landlord sit.Various of online games provided are dynamic sense and free indefinitely.We are looking forward to you to here share the experience of
    exciting game competition!
     

  • Agree with Landlord sit.Various of online games provided are dynamic sense and free indefinitely.We are looking forward to you to here share the experience of
    exciting game competition!
     

Leave a Reply

Your email address will not be published.