如何使make array从第一个问题转到下一个问题?
我可以为答案做同样的事情吗?
谢谢!
var allQuestions = [
{
question: "Welk kerstnummer draai jij grijs tijdens de feestdagen?",
responses: [{
text: 'Feliz Navidad',
}
var currentQuestion = 0;
function showQuestion() {
question = allQuestions[currentQuestion].question;
questions.innerHTML = "<p>" + question + "</p>";
for (var i = 0; i < allQuestions[currentQuestion].responses.length; i++) {
responses = allQuestions[currentQuestion].responses[i].text;
quizForm.innerHTML += "<button id='button'>" + responses + "</button>";
}
$('#choiceList').on('click', function() {
if (currentQuestion < allQuestions.length - 1) {
currentQuestion++;
} else {
alert('einde quiz')
return false;
}
document.getElementById("question").innerHTML = allQuestions[questions];
});
}