问题并没有进入下一个问题

oknwwptz  于 2021-09-29  发布在  Java
关注(0)|答案(0)|浏览(178)

当我单击按钮时,在从给定选项中选择答案后,问题不会前进到下一个问题,我无法识别问题,但我的getstarted函数正在工作,因为我通过console对其进行了测试。记录答案

let currentQuiz = 0;

    loadQuiz();

    function loadQuiz(){

        const questionQuizData = quizData[currentQuiz]

        QuestionEl.innerHTML = questionQuizData.question
        questionA.innerHTML = questionQuizData.a
        questionB.innerHTML = questionQuizData.b
        questionC.innerHTML = questionQuizData.c
        questionD.innerHTML = questionQuizData.d

    }

    function getStartded(){
        let answers = undefined;
        answerEl.forEach((answer) => {
            if(answer.checked){
                answers = answer.id;
            }
        })
        return answers;
    }

    submitEl.addEventListener('click', () => {
        const answer = getStartded();
        if(answer){
            currentQuiz++;
            loadQuiz();
        }
    })

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题