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 6338285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:24:48+00:00 2026-05-24T19:24:48+00:00

I am trying to modify this JQuery Countdown plugin to initialize itself when it

  • 0

I am trying to modify this JQuery Countdown plugin to initialize itself when it has a value in its div or span. I need because I’m building an application that will allow people to have any amount of countdowns on their page and they chose what the target date/time is.

As a reference, I’m doing my web app in ASP.Net, but I don’t think it really matters for my problem.

The date will be coming from a Database but I will probably be converting it in seconds in the code-behind. Basically, I want to be able to throw something like

<div id="93" class="countdown">300</div> /* Countdown of 300 seconds, 5 minutes */
<div id="104" class="countdown">19483</div> /*Countdown of 5 hours, 24 minutes and 43 seconds */

and initialize all this from a single line of JQuery

$(".countdown").countdown();

or

$(".countdown").countdown("initializeFromValue");

I’m starting to get familiar with JQuery itself, but I have a hard time changing the javascript in the back. I have started creating a new part in the code. My issue here is to verify if the div has a value in integer and then initialize the value of the Countdown to that value, deleting that value after.

I have also been trying in a test page to put 4 countdown:

    $(function () {
        $("#countdown").countdown({ until: $("#countdown").text() });
        $("#countdown2").countdown({ until: $("#countdown2").text() });
        $("#countdown3").countdown({ until: $("#countdown3").text() });
        $("#countdown4").countdown({ until: $("#countdown4").text() });
    });

This is working since every countdown has an unique ID and I can also get its own text value. But it is not flexible. Can I proceed from there as well? I know for sure that

$(".countdown").countdown({ until: $(this).text() });

doesn’t work because it thinks that “this” is “document”.

Can someone please redirect me to some documentation/tutorial that could help me fix this problem I have? Thank you.

  • 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-24T19:24:49+00:00Added an answer on May 24, 2026 at 7:24 pm

    32bitkid has the right idea. Here is why:

    when you use $(“.countdown”) you are selecting ALL of the divs that have class countdown. YOu can even assign them to an array and iterate through with a for loop but jquery gives us the .each() syntatic sugar so the idea is

     $(".countdown").each(function()   //loop through all divs with countdown as class
     {
       $(this).countdown({until: $(this).text()};  // "this" is not the specific div we are 
     }                                             //iterating on
    

    Hope that helps with why his method works

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to modify this: jquery desktop by adding a input field inside one
I have been dabbling around this morning trying to modify the jQuery cycle script
I am trying to modify this example of jQuery UI to accept the 2-dimensional
I'm trying to modify this bit of HTML with jQuery to delete the duplicate
I'm trying to modify the code from this script . Basically I'm trying to
I keep getting this error while trying to modify some tables. Here's my code:
I know this might be a bit awkward but I am trying to modify
i am trying to modify during runtime an image in my application, this image
I'm trying to modify this example: http://jqueryui.com/demos/autocomplete/#combobox to parse a similar select list, in
I am very new to JS and am trying to modify the JavascriptKit jQuery-based

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.