Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

add countdown timer to javascript quiz

var count = 15;
var interval = setInterval(function(){
  document.getElementById('count').innerHTML=count;
  count--;
  if (count === 0){
    clearInterval(interval);
    document.getElementById('count').innerHTML='Done';
    // or...
    alert("You're out of time!");
  }
}, 1000);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #add #countdown #timer #javascript #quiz
ADD COMMENT
Topic
Name
9+8 =