When I click on the correct answer in my quiz, I want the background color of a div to change and then after 1 or 2 seconds, make that div disappear. This is working correctly, but I would like the background color of the div to change first before executing this function.
function correctAnswer() {
if (twoQuestions.style.display = "none") {
twoQuestions.style.display = "block"
threeQuestions.style.display = "none"
fourQuestions.style.display = "none"
fiveQuestions.style.display = "none"
oneQuestion.style.display = "none"
}
} else {
alert("Wrong answer")
}
}