Search code examples
jquerycountdown

Problems with (multiple) jQuery countdowns


I'm working on a countdown right now. The goal is to display multiple countdowns on a page. One countdown with an interval() is not a problem, but when it gets to two or more countdowns it will only display the last countdown.

Countdown structure:

  1. Grab the unix timestamp from <div value"..."> <div>
  2. Turn unix timestamp with jQuery to a nice countdown.
  3. Display all countdowns on the page with .html() or .text()

Hope you can help me out.

http://jsfiddle.net/be89dwno/


Solution

  • try changing:

    $(".timestamp").text(function(k){
        return seconds[k];
    });
    

    with:

    $(this).text(seconds[k]);
    

    demo here