javascript - Disable submit button ONLY after submit -


i have following html , jquery:

<html dir="ltr" lang="en"> <head> </head> <body>  <h2>test disabling submit button 1 minute...</h2>  <br/>  <p style="text-align:center">  <form id="yourformid" name="yourformid" method="post" action="#">  <input type="submit" class="submitbtn" value="i accept"/> </form> </p>     <!--script disable submit button --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">   </script> <script type="text/javascript">  $(document).ready(function () {     $(".submitbtn").click(function () {         $(".submitbtn").attr("disabled", true);         return true;     }); });  </script> <!--script ends here-->  </body> </html> 

as stands submit button gets disabled when pressed. once pressed not seem perform submit. if removed jquery disable button, button performs submit normally.

how can disable button after has performed submit? current jquery above seems conflict submit operation.

any suggestions resolve issue extremely helpful.

add disable part in submit event.

$(document).ready(function () {     $("#yourformid").submit(function () {         $(".submitbtn").attr("disabled", true);         return true;     }); }); 

Comments