0

I have zero knowledge on jquery. and i feel sorry for that. what i want to achieve is something like this http://www.jqueryscript.net/demo/Final-Countdown-Simple-Date-Countdown-Plugin/examples/multiple_clocks.html

But i dont understand the how the code works. I try the code posted on that page but it returns nothing.

Can anybody help me with this? any help is very much appreciated.

2
  • Check for any JS error. Have you included all the necessay jquery and countdown plugin files ? Commented Jun 13, 2014 at 9:19
  • You need to also include jQuery and jqueryscript.net/demo/… for it to work Commented Jun 13, 2014 at 9:20

2 Answers 2

1

You need to copy and include the jQuery plugin

<script src="jquery.min.js" type="text/javascript"></script>
<script src="jquery.countdown.js" type="text/javascript"></script>

and provide data-until attribute like:

 <div data-countdown="12/05/2011" data-until="12/06/2014"></div>
 <div data-countdown="15/06/2011" data-until="12/06/2014"></div>
 <div data-countdown="20/07/2011" data-until="12/06/2014"></div>

See fiddle example

Sign up to request clarification or add additional context in comments.

Comments

0

Basically there are only two things happening. First

$('div[data-countdown]').each(function(i)

is a loop over all divs which have data attribute countdown. Second thing is applying the jquery countdown plugin to each of those elements. This happens on this line

$(this).countdown(toDate, function(event) {

$(this) represents each of the found elements. Not to forget as I mentioned it is a jquery plugin. So you need included jquery and jquery.countdown files in your html.

Edit: Including happens as this answer states.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.