Button value to be changed back to original value on timeout (form double submit)Prevent double submission of forms in jQueryJavaScript post request like a form submitChange the selected value of a drop-down list with jQueryTwo submit buttons in one formPrevent users from submitting a form by hitting EnterHow to prevent buttons from submitting formsjQuery disable/enable submit buttonjQuery AJAX submit formHTML button to NOT submit formCan I make a <button> not submit a form?Cannot display HTML string

Extract rows of a table, that include less than x NULLs

Why didn't Miles's spider sense work before?

How do I handle a potential work/personal life conflict as the manager of one of my friends?

Personal Teleportation: From Rags to Riches

GFCI outlets - can they be repaired? Are they really needed at the end of a circuit?

Why is this clock signal connected to a capacitor to gnd?

Why doesn't using multiple commands with a || or && conditional work?

In 'Revenger,' what does 'cove' come from?

How can I deal with my CEO asking me to hire someone with a higher salary than me, a co-founder?

Forgetting the musical notes while performing in concert

Detention in 1997

Intersection Puzzle

Alternative to sending password over mail?

Avoiding the "not like other girls" trope?

How to tell a function to use the default argument values?

Why is consensus so controversial in Britain?

Determining Impedance With An Antenna Analyzer

How writing a dominant 7 sus4 chord in RNA ( Vsus7 chord in the 1st inversion)

Examples of smooth manifolds admitting inbetween one and a continuum of complex structures

What does “the session was packed” mean in this context?

What is the idiomatic way to say "clothing fits"?

Is there a hemisphere-neutral way of specifying a season?

Why would the Red Woman birth a shadow if she worshipped the Lord of the Light?

Valid term from quadratic sequence?



Button value to be changed back to original value on timeout (form double submit)


Prevent double submission of forms in jQueryJavaScript post request like a form submitChange the selected value of a drop-down list with jQueryTwo submit buttons in one formPrevent users from submitting a form by hitting EnterHow to prevent buttons from submitting formsjQuery disable/enable submit buttonjQuery AJAX submit formHTML button to NOT submit formCan I make a <button> not submit a form?Cannot display HTML string













8















I am trying to fix a form double submit by disabling the submit button temporarily and changing the submit button value to "processing..." so the user knows what is going on.



The disable works onClick and the "Submit" value changes to "processing...", however I am unable to change the value back to "Submit" after the setTimeout function has ended.



Does anyone know how I could go about doing this?






$(function() 
$("#submit_btn").click(function()
$("#submit_btn").attr("disabled", "disabled");
this.value = "Processing...";
setTimeout(function()
this.value = "Submit"; //<- this line doesn't work
$("#submit_btn").removeAttr("disabled");
, 5000);
);
);

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="submit_btn" type="submit" value="Submit" />












share|improve this question




























    8















    I am trying to fix a form double submit by disabling the submit button temporarily and changing the submit button value to "processing..." so the user knows what is going on.



    The disable works onClick and the "Submit" value changes to "processing...", however I am unable to change the value back to "Submit" after the setTimeout function has ended.



    Does anyone know how I could go about doing this?






    $(function() 
    $("#submit_btn").click(function()
    $("#submit_btn").attr("disabled", "disabled");
    this.value = "Processing...";
    setTimeout(function()
    this.value = "Submit"; //<- this line doesn't work
    $("#submit_btn").removeAttr("disabled");
    , 5000);
    );
    );

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <input id="submit_btn" type="submit" value="Submit" />












    share|improve this question


























      8












      8








      8


      2






      I am trying to fix a form double submit by disabling the submit button temporarily and changing the submit button value to "processing..." so the user knows what is going on.



      The disable works onClick and the "Submit" value changes to "processing...", however I am unable to change the value back to "Submit" after the setTimeout function has ended.



      Does anyone know how I could go about doing this?






      $(function() 
      $("#submit_btn").click(function()
      $("#submit_btn").attr("disabled", "disabled");
      this.value = "Processing...";
      setTimeout(function()
      this.value = "Submit"; //<- this line doesn't work
      $("#submit_btn").removeAttr("disabled");
      , 5000);
      );
      );

      <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <input id="submit_btn" type="submit" value="Submit" />












      share|improve this question
















      I am trying to fix a form double submit by disabling the submit button temporarily and changing the submit button value to "processing..." so the user knows what is going on.



      The disable works onClick and the "Submit" value changes to "processing...", however I am unable to change the value back to "Submit" after the setTimeout function has ended.



      Does anyone know how I could go about doing this?






      $(function() 
      $("#submit_btn").click(function()
      $("#submit_btn").attr("disabled", "disabled");
      this.value = "Processing...";
      setTimeout(function()
      this.value = "Submit"; //<- this line doesn't work
      $("#submit_btn").removeAttr("disabled");
      , 5000);
      );
      );

      <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <input id="submit_btn" type="submit" value="Submit" />








      $(function() 
      $("#submit_btn").click(function()
      $("#submit_btn").attr("disabled", "disabled");
      this.value = "Processing...";
      setTimeout(function()
      this.value = "Submit"; //<- this line doesn't work
      $("#submit_btn").removeAttr("disabled");
      , 5000);
      );
      );

      <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <input id="submit_btn" type="submit" value="Submit" />





      $(function() 
      $("#submit_btn").click(function()
      $("#submit_btn").attr("disabled", "disabled");
      this.value = "Processing...";
      setTimeout(function()
      this.value = "Submit"; //<- this line doesn't work
      $("#submit_btn").removeAttr("disabled");
      , 5000);
      );
      );

      <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <input id="submit_btn" type="submit" value="Submit" />






      javascript jquery html






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 days ago









      Arend

      3,53012137




      3,53012137










      asked 2 days ago









      RobertRobert

      616




      616






















          5 Answers
          5






          active

          oldest

          votes


















          5














          Just change this to $("#submit_btn") and it works:






          $(function() 
          $("#submit_btn").click(function()
          $("#submit_btn").attr("disabled", "disabled");
          $("#submit_btn").val("Processing...");
          setTimeout(function()
          $("#submit_btn").val("Submit");
          $("#submit_btn").removeAttr("disabled");
          , 5000);
          );
          );

          <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
          <input id="submit_btn" type="submit" value="Submit" />





          The issue was that your functions were interfering with this. You could have done self = this which would have had the same effect:






          $(function() 
          $("#submit_btn").click(function()
          var self = this;
          $(self).attr("disabled", "disabled");
          $(self).val("Processing...");
          setTimeout(function()
          $(self).val("Submit");
          $(self).removeAttr("disabled");
          , 5000);
          );
          );

          <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
          <input id="submit_btn" type="submit" value="Submit" />





          Or you could have used event.target:






          $(function() 
          $("#submit_btn").click(function(event)
          $(event.target).attr("disabled", "disabled");
          $(event.target).val("Processing...");
          setTimeout(function()
          $(event.target).val("Submit");
          $(event.target).removeAttr("disabled");
          , 5000);
          );
          );

          <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
          <input id="submit_btn" type="submit" value="Submit" />








          share|improve this answer




















          • 1





            Explanation is needed to understand why you did what you did (and I didn't downvote).

            – LGSon
            2 days ago







          • 1





            Oh yes @LGSon - I'll add that.

            – Jack Bashford
            2 days ago






          • 1





            Awesome thanks man. I swear I tried that approach before I posted this question... must have forgotten a semi colon or something lol, rookie mistake. I'll accept your answer in 3 minutes when stackoverflow allows me. Cheers!

            – Robert
            2 days ago


















          2














          you just need to replace that line with the following code:
          $("#submit_btn").val("Submit");



          you should use val function to change the text of the button.






          share|improve this answer








          New contributor




          Anagha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.



























            2














             $(function() 
            $("#submit_btn").click(function(event)
            $('button').button( loadingText: 'Processing..' );
            $('#submit_btn').button('loading');
            //after submit stuff put below line to reset;
            $('#submit_btn').button('reset');
            );
            );


            above code work best when you used
            html button in place of input type button
            Note-- To Show Spin Icon inside Button put
            font-awesome or any other icon in place of Processing.. or both in loadingText object






            share|improve this answer










            New contributor




            Haider Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.




















            • it prevent multiple click (submit) until first click event completed by... disabling button by default ,,

              – Haider Ali
              2 days ago


















            1














            $(document).ready(function() 
            $(function()
            $("#submit_btn").click(function()
            $("#submit_btn").attr("disabled", "disabled");
            this.value = "Processing...";
            outerthis = this;
            setTimeout(function()
            outerthis.value = "Submit";
            $("#submit_btn").removeAttr("disabled");
            , 5000);
            );
            );
            );





            share|improve this answer










            New contributor




            SINGH AAKASH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.



























              0














              Problem about the wrong usage of this keyword inside setTimeout() has already been explained. However, if you are able to use arrow function expressions (ES6 feature), that won't be a problem:




              An arrow function expression is a syntactically compact alternative to a regular function expression, although without its own bindings to the this, arguments, super, or new.target keywords.




              Using this feature, your code can be simplified a little as shown on next example:






              $("#submit_btn").click(function()

              $(this).attr("disabled", "disabled").val("Processing...");

              setTimeout(
              () => $(this).val("Submit").removeAttr("disabled"),
              5000
              );
              );

              <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
              <input id="submit_btn" type="submit" value="Submit" />








              share|improve this answer

























                Your Answer






                StackExchange.ifUsing("editor", function ()
                StackExchange.using("externalEditor", function ()
                StackExchange.using("snippets", function ()
                StackExchange.snippets.init();
                );
                );
                , "code-snippets");

                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "1"
                ;
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function()
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled)
                StackExchange.using("snippets", function()
                createEditor();
                );

                else
                createEditor();

                );

                function createEditor()
                StackExchange.prepareEditor(
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader:
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                ,
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );













                draft saved

                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55448780%2fbutton-value-to-be-changed-back-to-original-value-on-timeout-form-double-submit%23new-answer', 'question_page');

                );

                Post as a guest















                Required, but never shown

























                5 Answers
                5






                active

                oldest

                votes








                5 Answers
                5






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                5














                Just change this to $("#submit_btn") and it works:






                $(function() 
                $("#submit_btn").click(function()
                $("#submit_btn").attr("disabled", "disabled");
                $("#submit_btn").val("Processing...");
                setTimeout(function()
                $("#submit_btn").val("Submit");
                $("#submit_btn").removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />





                The issue was that your functions were interfering with this. You could have done self = this which would have had the same effect:






                $(function() 
                $("#submit_btn").click(function()
                var self = this;
                $(self).attr("disabled", "disabled");
                $(self).val("Processing...");
                setTimeout(function()
                $(self).val("Submit");
                $(self).removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />





                Or you could have used event.target:






                $(function() 
                $("#submit_btn").click(function(event)
                $(event.target).attr("disabled", "disabled");
                $(event.target).val("Processing...");
                setTimeout(function()
                $(event.target).val("Submit");
                $(event.target).removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />








                share|improve this answer




















                • 1





                  Explanation is needed to understand why you did what you did (and I didn't downvote).

                  – LGSon
                  2 days ago







                • 1





                  Oh yes @LGSon - I'll add that.

                  – Jack Bashford
                  2 days ago






                • 1





                  Awesome thanks man. I swear I tried that approach before I posted this question... must have forgotten a semi colon or something lol, rookie mistake. I'll accept your answer in 3 minutes when stackoverflow allows me. Cheers!

                  – Robert
                  2 days ago















                5














                Just change this to $("#submit_btn") and it works:






                $(function() 
                $("#submit_btn").click(function()
                $("#submit_btn").attr("disabled", "disabled");
                $("#submit_btn").val("Processing...");
                setTimeout(function()
                $("#submit_btn").val("Submit");
                $("#submit_btn").removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />





                The issue was that your functions were interfering with this. You could have done self = this which would have had the same effect:






                $(function() 
                $("#submit_btn").click(function()
                var self = this;
                $(self).attr("disabled", "disabled");
                $(self).val("Processing...");
                setTimeout(function()
                $(self).val("Submit");
                $(self).removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />





                Or you could have used event.target:






                $(function() 
                $("#submit_btn").click(function(event)
                $(event.target).attr("disabled", "disabled");
                $(event.target).val("Processing...");
                setTimeout(function()
                $(event.target).val("Submit");
                $(event.target).removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />








                share|improve this answer




















                • 1





                  Explanation is needed to understand why you did what you did (and I didn't downvote).

                  – LGSon
                  2 days ago







                • 1





                  Oh yes @LGSon - I'll add that.

                  – Jack Bashford
                  2 days ago






                • 1





                  Awesome thanks man. I swear I tried that approach before I posted this question... must have forgotten a semi colon or something lol, rookie mistake. I'll accept your answer in 3 minutes when stackoverflow allows me. Cheers!

                  – Robert
                  2 days ago













                5












                5








                5







                Just change this to $("#submit_btn") and it works:






                $(function() 
                $("#submit_btn").click(function()
                $("#submit_btn").attr("disabled", "disabled");
                $("#submit_btn").val("Processing...");
                setTimeout(function()
                $("#submit_btn").val("Submit");
                $("#submit_btn").removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />





                The issue was that your functions were interfering with this. You could have done self = this which would have had the same effect:






                $(function() 
                $("#submit_btn").click(function()
                var self = this;
                $(self).attr("disabled", "disabled");
                $(self).val("Processing...");
                setTimeout(function()
                $(self).val("Submit");
                $(self).removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />





                Or you could have used event.target:






                $(function() 
                $("#submit_btn").click(function(event)
                $(event.target).attr("disabled", "disabled");
                $(event.target).val("Processing...");
                setTimeout(function()
                $(event.target).val("Submit");
                $(event.target).removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />








                share|improve this answer















                Just change this to $("#submit_btn") and it works:






                $(function() 
                $("#submit_btn").click(function()
                $("#submit_btn").attr("disabled", "disabled");
                $("#submit_btn").val("Processing...");
                setTimeout(function()
                $("#submit_btn").val("Submit");
                $("#submit_btn").removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />





                The issue was that your functions were interfering with this. You could have done self = this which would have had the same effect:






                $(function() 
                $("#submit_btn").click(function()
                var self = this;
                $(self).attr("disabled", "disabled");
                $(self).val("Processing...");
                setTimeout(function()
                $(self).val("Submit");
                $(self).removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />





                Or you could have used event.target:






                $(function() 
                $("#submit_btn").click(function(event)
                $(event.target).attr("disabled", "disabled");
                $(event.target).val("Processing...");
                setTimeout(function()
                $(event.target).val("Submit");
                $(event.target).removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />








                $(function() 
                $("#submit_btn").click(function()
                $("#submit_btn").attr("disabled", "disabled");
                $("#submit_btn").val("Processing...");
                setTimeout(function()
                $("#submit_btn").val("Submit");
                $("#submit_btn").removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />





                $(function() 
                $("#submit_btn").click(function()
                $("#submit_btn").attr("disabled", "disabled");
                $("#submit_btn").val("Processing...");
                setTimeout(function()
                $("#submit_btn").val("Submit");
                $("#submit_btn").removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />





                $(function() 
                $("#submit_btn").click(function()
                var self = this;
                $(self).attr("disabled", "disabled");
                $(self).val("Processing...");
                setTimeout(function()
                $(self).val("Submit");
                $(self).removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />





                $(function() 
                $("#submit_btn").click(function()
                var self = this;
                $(self).attr("disabled", "disabled");
                $(self).val("Processing...");
                setTimeout(function()
                $(self).val("Submit");
                $(self).removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />





                $(function() 
                $("#submit_btn").click(function(event)
                $(event.target).attr("disabled", "disabled");
                $(event.target).val("Processing...");
                setTimeout(function()
                $(event.target).val("Submit");
                $(event.target).removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />





                $(function() 
                $("#submit_btn").click(function(event)
                $(event.target).attr("disabled", "disabled");
                $(event.target).val("Processing...");
                setTimeout(function()
                $(event.target).val("Submit");
                $(event.target).removeAttr("disabled");
                , 5000);
                );
                );

                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                <input id="submit_btn" type="submit" value="Submit" />






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 2 days ago

























                answered 2 days ago









                Jack BashfordJack Bashford

                14.7k31848




                14.7k31848







                • 1





                  Explanation is needed to understand why you did what you did (and I didn't downvote).

                  – LGSon
                  2 days ago







                • 1





                  Oh yes @LGSon - I'll add that.

                  – Jack Bashford
                  2 days ago






                • 1





                  Awesome thanks man. I swear I tried that approach before I posted this question... must have forgotten a semi colon or something lol, rookie mistake. I'll accept your answer in 3 minutes when stackoverflow allows me. Cheers!

                  – Robert
                  2 days ago












                • 1





                  Explanation is needed to understand why you did what you did (and I didn't downvote).

                  – LGSon
                  2 days ago







                • 1





                  Oh yes @LGSon - I'll add that.

                  – Jack Bashford
                  2 days ago






                • 1





                  Awesome thanks man. I swear I tried that approach before I posted this question... must have forgotten a semi colon or something lol, rookie mistake. I'll accept your answer in 3 minutes when stackoverflow allows me. Cheers!

                  – Robert
                  2 days ago







                1




                1





                Explanation is needed to understand why you did what you did (and I didn't downvote).

                – LGSon
                2 days ago






                Explanation is needed to understand why you did what you did (and I didn't downvote).

                – LGSon
                2 days ago





                1




                1





                Oh yes @LGSon - I'll add that.

                – Jack Bashford
                2 days ago





                Oh yes @LGSon - I'll add that.

                – Jack Bashford
                2 days ago




                1




                1





                Awesome thanks man. I swear I tried that approach before I posted this question... must have forgotten a semi colon or something lol, rookie mistake. I'll accept your answer in 3 minutes when stackoverflow allows me. Cheers!

                – Robert
                2 days ago





                Awesome thanks man. I swear I tried that approach before I posted this question... must have forgotten a semi colon or something lol, rookie mistake. I'll accept your answer in 3 minutes when stackoverflow allows me. Cheers!

                – Robert
                2 days ago













                2














                you just need to replace that line with the following code:
                $("#submit_btn").val("Submit");



                you should use val function to change the text of the button.






                share|improve this answer








                New contributor




                Anagha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.
























                  2














                  you just need to replace that line with the following code:
                  $("#submit_btn").val("Submit");



                  you should use val function to change the text of the button.






                  share|improve this answer








                  New contributor




                  Anagha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






















                    2












                    2








                    2







                    you just need to replace that line with the following code:
                    $("#submit_btn").val("Submit");



                    you should use val function to change the text of the button.






                    share|improve this answer








                    New contributor




                    Anagha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.










                    you just need to replace that line with the following code:
                    $("#submit_btn").val("Submit");



                    you should use val function to change the text of the button.







                    share|improve this answer








                    New contributor




                    Anagha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.









                    share|improve this answer



                    share|improve this answer






                    New contributor




                    Anagha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.









                    answered 2 days ago









                    AnaghaAnagha

                    462




                    462




                    New contributor




                    Anagha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.





                    New contributor





                    Anagha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.






                    Anagha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.





















                        2














                         $(function() 
                        $("#submit_btn").click(function(event)
                        $('button').button( loadingText: 'Processing..' );
                        $('#submit_btn').button('loading');
                        //after submit stuff put below line to reset;
                        $('#submit_btn').button('reset');
                        );
                        );


                        above code work best when you used
                        html button in place of input type button
                        Note-- To Show Spin Icon inside Button put
                        font-awesome or any other icon in place of Processing.. or both in loadingText object






                        share|improve this answer










                        New contributor




                        Haider Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.




















                        • it prevent multiple click (submit) until first click event completed by... disabling button by default ,,

                          – Haider Ali
                          2 days ago















                        2














                         $(function() 
                        $("#submit_btn").click(function(event)
                        $('button').button( loadingText: 'Processing..' );
                        $('#submit_btn').button('loading');
                        //after submit stuff put below line to reset;
                        $('#submit_btn').button('reset');
                        );
                        );


                        above code work best when you used
                        html button in place of input type button
                        Note-- To Show Spin Icon inside Button put
                        font-awesome or any other icon in place of Processing.. or both in loadingText object






                        share|improve this answer










                        New contributor




                        Haider Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.




















                        • it prevent multiple click (submit) until first click event completed by... disabling button by default ,,

                          – Haider Ali
                          2 days ago













                        2












                        2








                        2







                         $(function() 
                        $("#submit_btn").click(function(event)
                        $('button').button( loadingText: 'Processing..' );
                        $('#submit_btn').button('loading');
                        //after submit stuff put below line to reset;
                        $('#submit_btn').button('reset');
                        );
                        );


                        above code work best when you used
                        html button in place of input type button
                        Note-- To Show Spin Icon inside Button put
                        font-awesome or any other icon in place of Processing.. or both in loadingText object






                        share|improve this answer










                        New contributor




                        Haider Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.










                         $(function() 
                        $("#submit_btn").click(function(event)
                        $('button').button( loadingText: 'Processing..' );
                        $('#submit_btn').button('loading');
                        //after submit stuff put below line to reset;
                        $('#submit_btn').button('reset');
                        );
                        );


                        above code work best when you used
                        html button in place of input type button
                        Note-- To Show Spin Icon inside Button put
                        font-awesome or any other icon in place of Processing.. or both in loadingText object







                        share|improve this answer










                        New contributor




                        Haider Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.









                        share|improve this answer



                        share|improve this answer








                        edited 2 days ago





















                        New contributor




                        Haider Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.









                        answered 2 days ago









                        Haider AliHaider Ali

                        213




                        213




                        New contributor




                        Haider Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.





                        New contributor





                        Haider Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.






                        Haider Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.












                        • it prevent multiple click (submit) until first click event completed by... disabling button by default ,,

                          – Haider Ali
                          2 days ago

















                        • it prevent multiple click (submit) until first click event completed by... disabling button by default ,,

                          – Haider Ali
                          2 days ago
















                        it prevent multiple click (submit) until first click event completed by... disabling button by default ,,

                        – Haider Ali
                        2 days ago





                        it prevent multiple click (submit) until first click event completed by... disabling button by default ,,

                        – Haider Ali
                        2 days ago











                        1














                        $(document).ready(function() 
                        $(function()
                        $("#submit_btn").click(function()
                        $("#submit_btn").attr("disabled", "disabled");
                        this.value = "Processing...";
                        outerthis = this;
                        setTimeout(function()
                        outerthis.value = "Submit";
                        $("#submit_btn").removeAttr("disabled");
                        , 5000);
                        );
                        );
                        );





                        share|improve this answer










                        New contributor




                        SINGH AAKASH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.
























                          1














                          $(document).ready(function() 
                          $(function()
                          $("#submit_btn").click(function()
                          $("#submit_btn").attr("disabled", "disabled");
                          this.value = "Processing...";
                          outerthis = this;
                          setTimeout(function()
                          outerthis.value = "Submit";
                          $("#submit_btn").removeAttr("disabled");
                          , 5000);
                          );
                          );
                          );





                          share|improve this answer










                          New contributor




                          SINGH AAKASH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






















                            1












                            1








                            1







                            $(document).ready(function() 
                            $(function()
                            $("#submit_btn").click(function()
                            $("#submit_btn").attr("disabled", "disabled");
                            this.value = "Processing...";
                            outerthis = this;
                            setTimeout(function()
                            outerthis.value = "Submit";
                            $("#submit_btn").removeAttr("disabled");
                            , 5000);
                            );
                            );
                            );





                            share|improve this answer










                            New contributor




                            SINGH AAKASH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.










                            $(document).ready(function() 
                            $(function()
                            $("#submit_btn").click(function()
                            $("#submit_btn").attr("disabled", "disabled");
                            this.value = "Processing...";
                            outerthis = this;
                            setTimeout(function()
                            outerthis.value = "Submit";
                            $("#submit_btn").removeAttr("disabled");
                            , 5000);
                            );
                            );
                            );






                            share|improve this answer










                            New contributor




                            SINGH AAKASH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.









                            share|improve this answer



                            share|improve this answer








                            edited 2 days ago









                            Arend

                            3,53012137




                            3,53012137






                            New contributor




                            SINGH AAKASH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.









                            answered 2 days ago









                            SINGH AAKASHSINGH AAKASH

                            192




                            192




                            New contributor




                            SINGH AAKASH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.





                            New contributor





                            SINGH AAKASH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.






                            SINGH AAKASH is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.





















                                0














                                Problem about the wrong usage of this keyword inside setTimeout() has already been explained. However, if you are able to use arrow function expressions (ES6 feature), that won't be a problem:




                                An arrow function expression is a syntactically compact alternative to a regular function expression, although without its own bindings to the this, arguments, super, or new.target keywords.




                                Using this feature, your code can be simplified a little as shown on next example:






                                $("#submit_btn").click(function()

                                $(this).attr("disabled", "disabled").val("Processing...");

                                setTimeout(
                                () => $(this).val("Submit").removeAttr("disabled"),
                                5000
                                );
                                );

                                <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                                <input id="submit_btn" type="submit" value="Submit" />








                                share|improve this answer





























                                  0














                                  Problem about the wrong usage of this keyword inside setTimeout() has already been explained. However, if you are able to use arrow function expressions (ES6 feature), that won't be a problem:




                                  An arrow function expression is a syntactically compact alternative to a regular function expression, although without its own bindings to the this, arguments, super, or new.target keywords.




                                  Using this feature, your code can be simplified a little as shown on next example:






                                  $("#submit_btn").click(function()

                                  $(this).attr("disabled", "disabled").val("Processing...");

                                  setTimeout(
                                  () => $(this).val("Submit").removeAttr("disabled"),
                                  5000
                                  );
                                  );

                                  <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                                  <input id="submit_btn" type="submit" value="Submit" />








                                  share|improve this answer



























                                    0












                                    0








                                    0







                                    Problem about the wrong usage of this keyword inside setTimeout() has already been explained. However, if you are able to use arrow function expressions (ES6 feature), that won't be a problem:




                                    An arrow function expression is a syntactically compact alternative to a regular function expression, although without its own bindings to the this, arguments, super, or new.target keywords.




                                    Using this feature, your code can be simplified a little as shown on next example:






                                    $("#submit_btn").click(function()

                                    $(this).attr("disabled", "disabled").val("Processing...");

                                    setTimeout(
                                    () => $(this).val("Submit").removeAttr("disabled"),
                                    5000
                                    );
                                    );

                                    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                                    <input id="submit_btn" type="submit" value="Submit" />








                                    share|improve this answer















                                    Problem about the wrong usage of this keyword inside setTimeout() has already been explained. However, if you are able to use arrow function expressions (ES6 feature), that won't be a problem:




                                    An arrow function expression is a syntactically compact alternative to a regular function expression, although without its own bindings to the this, arguments, super, or new.target keywords.




                                    Using this feature, your code can be simplified a little as shown on next example:






                                    $("#submit_btn").click(function()

                                    $(this).attr("disabled", "disabled").val("Processing...");

                                    setTimeout(
                                    () => $(this).val("Submit").removeAttr("disabled"),
                                    5000
                                    );
                                    );

                                    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                                    <input id="submit_btn" type="submit" value="Submit" />








                                    $("#submit_btn").click(function()

                                    $(this).attr("disabled", "disabled").val("Processing...");

                                    setTimeout(
                                    () => $(this).val("Submit").removeAttr("disabled"),
                                    5000
                                    );
                                    );

                                    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                                    <input id="submit_btn" type="submit" value="Submit" />





                                    $("#submit_btn").click(function()

                                    $(this).attr("disabled", "disabled").val("Processing...");

                                    setTimeout(
                                    () => $(this).val("Submit").removeAttr("disabled"),
                                    5000
                                    );
                                    );

                                    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
                                    <input id="submit_btn" type="submit" value="Submit" />






                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited 2 days ago

























                                    answered 2 days ago









                                    ShiderszShidersz

                                    9,7352933




                                    9,7352933



























                                        draft saved

                                        draft discarded
















































                                        Thanks for contributing an answer to Stack Overflow!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid


                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.

                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55448780%2fbutton-value-to-be-changed-back-to-original-value-on-timeout-form-double-submit%23new-answer', 'question_page');

                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

                                        Crop image to path created in TikZ? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Crop an inserted image?TikZ pictures does not appear in posterImage behind and beyond crop marks?Tikz picture as large as possible on A4 PageTransparency vs image compression dilemmaHow to crop background from image automatically?Image does not cropTikzexternal capturing crop marks when externalizing pgfplots?How to include image path that contains a dollar signCrop image with left size given

                                        Romeo and Juliet ContentsCharactersSynopsisSourcesDate and textThemes and motifsCriticism and interpretationLegacyScene by sceneSee alsoNotes and referencesSourcesExternal linksNavigation menu"Consumer Price Index (estimate) 1800–"10.2307/28710160037-3222287101610.1093/res/II.5.31910.2307/45967845967810.2307/2869925286992510.1525/jams.1982.35.3.03a00050"Dada Masilo: South African dancer who breaks the rules"10.1093/res/os-XV.57.1610.2307/28680942868094"Sweet Sorrow: Mann-Korman's Romeo and Juliet Closes Sept. 5 at MN's Ordway"the original10.2307/45957745957710.1017/CCOL0521570476.009"Ram Leela box office collections hit massive Rs 100 crore, pulverises prediction"Archived"Broadway Revival of Romeo and Juliet, Starring Orlando Bloom and Condola Rashad, Will Close Dec. 8"Archived10.1075/jhp.7.1.04hon"Wherefore art thou, Romeo? To make us laugh at Navy Pier"the original10.1093/gmo/9781561592630.article.O006772"Ram-leela Review Roundup: Critics Hail Film as Best Adaptation of Romeo and Juliet"Archived10.2307/31946310047-77293194631"Romeo and Juliet get Twitter treatment""Juliet's Nurse by Lois Leveen""Romeo and Juliet: Orlando Bloom's Broadway Debut Released in Theaters for Valentine's Day"Archived"Romeo and Juliet Has No Balcony"10.1093/gmo/9781561592630.article.O00778110.2307/2867423286742310.1076/enst.82.2.115.959510.1080/00138380601042675"A plague o' both your houses: error in GCSE exam paper forces apology""Juliet of the Five O'Clock Shadow, and Other Wonders"10.2307/33912430027-4321339124310.2307/28487440038-7134284874410.2307/29123140149-661129123144728341M"Weekender Guide: Shakespeare on The Drive""balcony"UK public library membership"romeo"UK public library membership10.1017/CCOL9780521844291"Post-Zionist Critique on Israel and the Palestinians Part III: Popular Culture"10.2307/25379071533-86140377-919X2537907"Capulets and Montagues: UK exam board admit mixing names up in Romeo and Juliet paper"Istoria Novellamente Ritrovata di Due Nobili Amanti2027/mdp.390150822329610820-750X"GCSE exam error: Board accidentally rewrites Shakespeare"10.2307/29176390149-66112917639"Exam board apologises after error in English GCSE paper which confused characters in Shakespeare's Romeo and Juliet""From Mariotto and Ganozza to Romeo and Guilietta: Metamorphoses of a Renaissance Tale"10.2307/37323537323510.2307/2867455286745510.2307/28678912867891"10 Questions for Taylor Swift"10.2307/28680922868092"Haymarket Theatre""The Zeffirelli Way: Revealing Talk by Florentine Director""Michael Smuin: 1938-2007 / Prolific dance director had showy career"The Life and Art of Edwin BoothRomeo and JulietRomeo and JulietRomeo and JulietRomeo and JulietEasy Read Romeo and JulietRomeo and Julieteeecb12003684p(data)4099369-3n8211610759dbe00d-a9e2-41a3-b2c1-977dd692899302814385X313670221313670221