ss
let timerInterval;
let timeLeft = 5400; // 90 minutes
function startQuiz() {
document.querySelector(".start-btn-container").style.display = "none";
document.getElementById("quizContainer").style.display = "block";
document.getElementById("timerBox").style.display = "block";
loadQuestions();
startTimer();
}
function updateTimerDisplay(seconds) {
const mins = String(Math.floor(seconds / 60)).padStart(2, '0');
const secs = String(seconds % 60).padStart(2, '0');
document.getElementById("timer").textContent = `${mins}:${secs}`;
}
function startTimer() {
updateTimerDisplay(timeLeft);
timerInterval = setInterval(() => {
timeLeft--;
updateTimerDisplay(timeLeft);
if (timeLeft <= 0) {
clearInterval(timerInterval);
document.getElementById("quizForm").requestSubmit();
}
}, 1000);
}