when i click on my eventlistener which makes it go to the next question, i want the checkboxes to kind of "refresh". now it stucks on what the player answered on the previous questing, please give me som help
html
`<span id="choices" class="hidden">
<input type="checkbox" id="choice1" class="checkboxes"> <span id="answer1"></span>
<br>
<br>
<input type="checkbox" id="choice2" class="checkboxes"> <span id="answer2"></span>
<br>
<br>
<input type="checkbox" id="choice3" class="checkboxes"> <span id="answer3"></span>
<br>
<br>
<input type="checkbox" id="choice4" class="checkboxes"> <span id="answer4"></span>
<br>
<br>
<hr style="margin-bottom: 50px">
<button id="next"> Next</button></span>`
the eventlistner
`next.addEventListener("click", function (e) {
if (quiz.checkAnswer()) {
quiz.score++;
};
console.log(quiz.checkAnswer());
quiz.nextQuestion();
quiz.display();
if(quiz.currentQuestion < quiz.quests.length) {
document.getElementById("question").innerHTML = quiz.quests[quiz.currentQuestion].question;
document.getElementById("answer1").innerHTML = quiz.quests[quiz.currentQuestion].answer[0].alt;
document.getElementById("answer2").innerHTML = quiz.quests[quiz.currentQuestion].answer[1].alt;
document.getElementById("answer3").innerHTML = quiz.quests[quiz.currentQuestion].answer[2].alt;
document.getElementById("answer4").innerHTML = quiz.quests[quiz.currentQuestion].answer[3].alt;
}
quiz.setName();
quiz.setnoOfQuestions();
quiz.progress();
quiz.amountOfQuestions();
quiz.finalScore();
});
}); `
Aucun commentaire:
Enregistrer un commentaire