$(function () { var duration = 60 * minutes, display = $('#time'); startTimer(duration, display); }); function startTimer(duration, display) { var timer = duration, minutes, seconds; var t = setInterval(function () { minutes = parseInt(timer / 60, 10); seconds = parseInt(timer % 60, 10); minutes = minutes < 10 ? "0" + minutes : minutes; seconds = seconds < 10 ? "0" + seconds : seconds; display.text(minutes + ":" + seconds); if (--timer < 0) { timer = 0; clearInterval(t); $('#frmquiz').submit(); } }, 1000); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)