Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1086873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:52:00+00:00 2026-05-16T22:52:00+00:00

I am using the following code to countdown before enabling a button. <script type=text/javascript>

  • 0

I am using the following code to countdown before enabling a button.

<script type="text/javascript">
$.fn.timedDisable = function(time) {
    if (time == null) { time = 5000; }
    return $(this).each(function() {
        $(this).attr('disabled', 'disabled');
        var disabledElem = $(this);
        setTimeout(function() {
            disabledElem.removeAttr('disabled');
        }, time);
    });
};

$(function() {
    $('#btnContinue').timedDisable();
});
</script>

How can I get the button value to read value=”Continue (x)”,
Where x is the number of seconds remaining until it’s enabled, after which it’s just value=”Continue”?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:52:01+00:00Added an answer on May 16, 2026 at 10:52 pm

    How about this:

    Example: http://jsfiddle.net/mgSVX/2/ EDIT:(updated the example to use the text value requested)

    $.fn.timedDisable = function(time) {
        if (time == null) {
            time = 5000;
        }
        var seconds = Math.ceil(time / 1000);  // Calculate the number of seconds
        return $(this).each(function() {
            $(this).attr('disabled', 'disabled');
            var disabledElem = $(this);
            var originalText = this.innerHTML;  // Remember the original text content
    
              // append the number of seconds to the text
            disabledElem.text( originalText + ' (' + seconds + ')'); 
    
             // do a set interval, using an interval of 1000 milliseconds
             //     and clear it after the number of seconds counts down to 0
            var interval = setInterval(function() {
                    // decrement the seconds and update the text
                disabledElem.text( originalText + ' (' + seconds + ')');  
                if (seconds === 0) {  // once seconds is 0...
                    disabledElem.removeAttr('disabled')
                        .text(originalText);   //reset to original text
                    clearInterval(interval);  // clear interval
                }
            }, 1000);
        });
    };
    
    $(function() {
        $('#btnContinue').timedDisable();
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using following code to alert id of current element. <input type=text id=desc name=txtTitle
Using following code I try to get updated list of checkbuttons' corresponding text values,
I am using following code for showing a MessageBox with ok and cancel button.
I am using following code to show a spinning wheel: $(#loading) .hide() .ajaxStart(function(){ $(this).show();
I am using following code to get bitmap from url. This function is used
I'm using following code to converted entered number in text field to be formatted
I'm Using following code in flex4 mxml That works fine. <mx:Button label=Set focus to
I have using following code to set a thread on button action. public void
I'm using following code to extract a string variable in my JavaScript file in
Using following code: db.changes({'include_docs':true}).on('response', function (res) { res.on('data', function (change) { console.log(change); }); });

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.