I am preparing an exam page. I have a time counter and it counts back from 60 seconds down to 0. There is a button NEXT
, I want to skip to the next question when the time ends for the question. When you select your answer through the radio buttons and click NEXT
, the page redirects to the next question, but when the time is up, I want the BUTTON
be clicked automatically in order to skip to the next question.
Here is my code for counter :
function startResetTimer() {
time = 60;
interval = setInterval(function() {
time--;
document.getElementById('Label1').innerHTML = "" + time + " seconds"
}, 1000)
}
The remaining time is shown on the label label1
and the name of my button is SubmitButton
.
Here is a JSFiddle: https://jsfiddle.net/ddan/cmtqzwa7/