I'm trying to make a timer, until it's working, the problem is that it only slows down if I click, and I need it to go away once I click once.
var mins = "30";
var secs = "00";
function timeCount(){
if (secs == "00"){
secs = "60";
mins -= 1;
}
i = 0;
do {
secs -= 01;
i++;
}
while(i < secs.length);
if (secs < "10"){
secs = "0" + secs +"";
}
if (mins == "0"){
console.log("acabou");
}
time = ''+ mins + ':' + secs + '';
$("#time").html(time);
console.log(time);
}
<div id="timer" onclick="setTimeout(timeCount, 3000)">
<span id="time">30:00</span>
</div>
If someone can give me a hand there, I thank them. : D