I am trying to create a timer that is displayed on screen that starts at 90 minutes and submits the page when the time goes to 0. Right now I can get it to work, but I can't display the minutes, only seconds (90 min = 5400 sec). I would like for the time to say something like 20 minutes and 5 seconds remaining instead of 1205 seconds remaining.
CODE:
<p>Time remaining: <span id="count">5400</span> seconds</p>
<script type="text/javascript">
window.onload = function(){
(function(){
var counter = 5400;
setInterval(function() {
counter--;
if (counter >= 0) {
span = document.getElementById("count");
span.innerHTML = counter;
}
if (counter === 0) {
//i will write the page submit code here
}
}, 1000);
})();
}
</script>