title: javascript/jquery countdown timer with JSfiddle example?
body: <p>I am building a few things and one of them is a countdown timer, the countdown will never be over an hour so all I need to do is countdown minutes and seconds.</p>
  
  <p>I have it partially working, but the problem is with the leading zeros. I got it to work in the seconds but not with the minutes.</p>
  
  <p>Check out my example <a href="http://jsfiddle.net/cgweb87/GHNtk/" rel="nofollow">http://jsfiddle.net/cgweb87/GHNtk/</a></p>
  
  <p><strong>JavaScript</strong></p>
  
  <pre><code>setInterval(function() {
  var timer = $('span').html();
  timer = timer.split(':');
  var minutes = timer[0];
  var seconds = timer[1];
  seconds -= 1;
  if (minutes &lt; 0) return;
  if (minutes &lt; 10 &amp;&amp; length.minutes != 2) minutes = '0' + minutes;
  if (seconds &lt; 0 &amp;&amp; minutes != 0) {
      minutes -= 1;
      seconds = 59;
  }
  else if (seconds &lt; 10 &amp;&amp; length.seconds != 2) seconds = '0' + seconds;
      $('span').html(minutes + ':' + seconds);
  }, 1000);
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;span&gt;10:10&lt;/span&gt;
  </code></pre>
  
  <p>What I want to happen is the countdown timer can begin anywhere under 1 hour, it will count down with leading zeros ie in this format;</p>
  
  <p>08:49
  46:09</p>
  
  <p>And when it reaches the countdown to simply just display:</p>
  
  <p>00:00</p>
  
  <p>Thanks for any input, and I don't want to use plugins, I want to learn it.</p>