It is necessary to make a count of the specified number of seconds when clicking on the button. It is necessary to count out 20 seconds, but also hundredths of a second should be considered.
Timer block code:
<div class="timer">00:<span class="seconds">20</span>:<span class="centisecond">00</span></div> For seconds, I did this:
function timer() { var seconds = 20; var seconds_timer_id = setInterval(function() { if (seconds > 0) { seconds --; if (seconds < 10) { seconds = "0" + seconds; } $(".seconds").text(seconds); } else { clearInterval(seconds_timer_id); } }, 1000); } How to make hundredths of a second?