ga-wdi-exercises / project1

[project] GA- Project 1
3 stars 75 forks source link

timer won't count down #187

Closed ghost closed 9 years ago

ghost commented 9 years ago

The counter counts down 1 second then stops. I can't figure out how to keep showing all the count downs until 0

$(document).ready(function(){
function createTimer(){
var counter = 5;
var timer = null;

$("#button1").click(function(){
  var counterBox = $(".numberbox").html("counter:"+ ' '+counter )

var timer = setInterval(function(){
 counter--;
if (counter >= -1){
  counterBox.html("counter:"+ ' '+counter )
}
  if (counter === 0)
    clearInterval(timer)

  else {clearInterval(timer)}

}, 1000);

  })

  };

createTimer()

});/*document end */
ghost commented 9 years ago

So

RobertAKARobin commented 9 years ago

Did you mean to close this?