Disable button after submit form by JQuery or disable multiple form submission

Disable button after submit form by JQuery or disable multiple form submission

Disable button after submit form by JQuery or disable multiple form submission

Sometimes it happens, multiple form are submitting by click on submit button.

It may be happen by user who want to sure post submitted or not, then they click many time to sure the post is submitted successfully. 

So we need to stop multiple form submission on single post. There are many way we can stop this.I have a easy solution in jQuery. If we disable submit button after from submission then multiple click will not work.

So let's make a simple html form with submit button tag.

Submit button & form design.

<!DOCTYPE html>
<html>
<body>
<p>Disable Multiple from submission or disable submit button after click.</p>
<button type="submit" id="final-btn" class="mybtn1 btn btn-danger" style="outline: 0; background:red; padding:8px 15px; color:#fff;" >Submit Now</button>
<script type="text/javascript">
  $(document).ready(function () {
      $("#final-btn").click(function () {
          setTimeout(function () { disableButton(); }, 0);
      });
      function disableButton() {
          $("#final-btn").prop('disabled', true);
      }
  });
  </script>
</body>
</html>


Thanks for read this.

Comments


  • jquery
  • disable button after click in jquery
  • disable multiple form submission
  • disable button after submit