+ 1
why not working properly?
2 Answers
+ 3
Use setInterval and clearInterval for timer counting, setTimeout only run once.
Try this:
var count, countNumber;
function start(){
countNumber = 11;
count = setInterval(countTrigger, 1000);
}
function countTrigger(){
if(countNumber > 0){
countNumber-- ;
document.getElementById("arb").innerHTML = countNumber ;
}
}
function stop(){
clearTimeout(count);
}
+ 2
@Calvin thanks