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

  • Home
  • SEARCH
  • 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 8745485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:01:17+00:00 2026-06-13T12:01:17+00:00

i have problem with my script using jquery.countdown.js plugin, it doesn’t sets multiple instances

  • 0

i have problem with my script using jquery.countdown.js plugin, it doesn’t sets multiple instances for each element i pass it to, it always sets the first instance for all, so countdowns are always the same.

link to plugin : http://keith-wood.name/countdown.html

   $(function(){

     $.each($('.countdown'), function() {
     var _element = '.countdown-'+$(this).attr("id");
     if($(_element).length > 0){
    var _expDate = $(_element).attr('data-expiration').split(',');
    var _datetime = Date(_expDate);
    init_countdown(_element,_datetime);
   }

});      
});

  function init_countdown(_element,_datetime){
    console.log(_element + ", " + _datetime)
    $(_element).countdown({
      until: _datetime,
      format: 'yowdHMS'
    });

  }

HTML:

<h5 class="muted countdown countdown-1" id="1" data-expiration="2014,10,26,14,10,35"> 2014-10-26 14:10:35</h5>
<h5 class="muted countdown countdown-2" id="2" data-expiration="2014,10,26,16,10,35"> 2014-10-26 16:10:35</h5>
<h5 class="muted countdown countdown-3" id="3" data-expiration="2014,10,26,18,10,35"> 2014-10-26 18:10:35</h5>

this is how it outputs

enter image description here

how can i fix this?

console.log() 

.countdown-1, Sun Oct 28 2012 22:10:09 GMT+0100 (CET)


.countdown-2, Sun Oct 28 2012 22:10:09 GMT+0100 (CET)


.countdown-3, Sun Oct 28 2012 22:10:09 GMT+0100 (CET)

@Asad example:

enter image description here

  • 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-06-13T12:01:19+00:00Added an answer on June 13, 2026 at 12:01 pm

    The date constructor (in the form you are using it) accepts several integer values, not an array. You need to turn each value in the array that results from your split into a integer (using parseInt), then pass each argument individually, and not as an array.

    Try this:

    var _expDate = $(_element).attr('data-expiration').split(',');
    _expDate.forEach(function(v,i,a){a[i]=parseInt(a[i]);});
    var _datetime = new Date(_expDate[0],_expDate[1],_expDate[2],_expDate[3],_expDate[4],_expDate[5]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with dynamically added script element (using jQuery). Code for adding
I have problem with detecting minimum words using jquery.validation.js. As i got a script
I have a problem using ajax (jquery) and recursion. I call a php script
I'm using jquery Ui datepicker plugin and i have a dive containing swf element
I have a problem with charset on a php script using jQuery for AJAX
I am using the jQuery form validation plugin. The problem I have is that
Good morning, I have problem with using MasterPage and jQuery. I using jQuery UI
I have a problem updating MySQL rows using Jquery. This is my current code.
I have a problem I am using jquery U.I tabs that load everything with
Hi I am really new to Jquery and have a problem with my script

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.