I want to make a timer in jQuery, I want change the value of span each second I make like this, but it delay is not working.
function startTimer(daysRemain,hoursRemain,minutesRemain,secondsRemain){
while(secondsRemain < 60){
secondsRemain++;
$("span.secondRemain").delay(1000).text(secondsRemain); //change value of seconds each one second
// I try this way too!
/* setTimeout(function(){
$("span.secondRemain").text(secondsRemain);
},1000);*/
}
delay
is only for the fx queue.
A standard timer is as follows
var t = 0;
setInterval(function () {
$('div').text(t);
t += 1;
},1000);