Today we are going to create a Countdown timer that shows minutes & Seconds.

How to Create jQuery Countdown Timer with Minutes & Seconds

In the initial step, you need to load the latest version of jQuery into your file.

<script src=""></script>

Now the important step to create the HMTL markup. Let’s create a div with a class name countdown. Remember, we will use this class in jQuery.

<div class="countdown"></div>

The Javascript

Finally, we will write down our jquery code.

<script type="text/javascript">
var timer2 = "02:00";
var interval = setInterval(function() {

  var timer = timer2.split(':');
  //by parsing integer, I avoid all extra string processing
  var minutes = parseInt(timer[0], 10);
  var seconds = parseInt(timer[1], 10);
  minutes = (seconds < 0) ? --minutes : minutes;
  if (minutes < 0) clearInterval(interval);
  seconds = (seconds < 0) ? 59 : seconds;
  seconds = (seconds < 10) ? '0' + seconds : seconds;
  //minutes = (minutes < 10) ?  minutes : minutes;
  $('.countdown').html(minutes + ':' + seconds);
  timer2 = minutes + ':' + seconds;
}, 1000);



  1. turkce says:

    When some one searches for his necessary thing, therefore he/she wishes to be available that in detail, so that thing is maintained over here. Juliana Lionel Gensler

  2. Carmine says:

    When someone writes an piece of writing he/she keeps the thought of
    a user in his/her mind that how a user can be aware of it.
    So that’s why this post is perfect. Thanks!

Post your comment

Your email address will not be published. Required fields are marked *