Closed ghost closed 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 */
So
Did you mean to close this?
The counter counts down 1 second then stops. I can't figure out how to keep showing all the count downs until 0