0
I am mounting a questionnaire where each question should appear one at a time on the screen for the user and, as soon as the user answers it, he should proceed to the next question.
For this I am using a for to go from question to question and a function to assemble the question with the possible answers as code below:
for (let aux = 1; aux < nrPerguntas + 1; aux ++) {
montaQuestionario(aux)
}
function montaQuestionario(aux) {
pPergunta.innerHTML = perguntas(aux)
pEscala.innerHTML = ""
for ( var i= 0; i < respostas.length ; i++) {
pEscala.innerHTML = pEscala.innerHTML + `<td class="tdBorda" onclick="#"> ${respostas[i][1]} </td><td class="tdBranco"></td>`
}
}
My problem is that the for goes from the first to the last question without pausing when it goes to the mount functionQuestionario() and if you break it stops running.
Is there any way to make it wait for a return or action from the user to continue? This action would be within the function since it would be there that the user would make the response selection.
Ricardo, it is not very clear in the question you want. If you give an edited believe that it is easier to get answer.
– renatomt
Good morning, I rewrote the doubt, whether it’s clearer now.
– Ricardo Jardim Braz