A Pen by Trenton (codepen.io)
so, I’m nearing the end of an old project I was working on and I can’t seem to reset the app correctly.
if you fail the quiz a reset button will display allowing you to reset the quiz. However, the functionality of the buttons do not work after the quiz is reset. I can’t figure out what the problem is here. Any hints would be greatly appreciated!
You have another issue. I took the quiz and got to question number 5 and when I tried to submit answer, it stopped working. I looked at the browser console and got the following:
I never got to the reset button.
Yeah, I know about that one. Just fail an answer on purpose to get to the reset.
Your reset button creates html with a new button that needs to be clicked to start the quiz. The new button does not have an event listener attached to it.
I would strongly recommend you rethink your quiz design here. You already have everything set up (html and event listeners) when the page loads. Instead of constantly overwriting the inner HTML of
quizBoardContainer, I would create a separate element that displays the questions and then hide/unhide it. Then, for each question, you would just update the
span containing the seconds left, the
h2 containing the question, and the
span which shows the correct answers value.
Yeah, this project is giving me all kinds of problems. Thanks for the advice