function countDownRound() { if(myRoundTimeRemaining >= 0){ var secs = myRoundTimeRemaining; if(secs < 10) { secs = "0" + secs; } $("#countdown").html(':'+secs); CountdownTimer = setTimeout(countDownRound, 1000); myRoundTimeRemaining--; } else{ $("#countdown").html(''); } }
The above code does what is expected in Firefox. Every second, a decreasing number is displayed in the countdown element.
In Safari and Chrome, the code works correctly, but the item on the screen does not change. If something else happens (for example, resizing the browser window), the elements are updated correctly.
It looks like an optimization or a thread based problem, but I cannot find a solution.
source share