Hi,
Working on a quiz app in Javascript and so everything is working except after I click on an answer I can keep clicking on the other answers.
How do I prevent/disable the all answers once a choice is made ?
In my loadQuestion function I add the question and possible answers, which there are 4, to the page.
Thanks!
Working on a quiz app in Javascript and so everything is working except after I click on an answer I can keep clicking on the other answers.
How do I prevent/disable the all answers once a choice is made ?
In my loadQuestion function I add the question and possible answers, which there are 4, to the page.
JavaScript:
for (let i = 0; i < choices.length; i++)
{
const choiceElem = document.createElement('div');
let choiceText = choices[i];
choiceElem.classList.add('choice');
choiceElem.textContent = choiceText;
clickHandle = ()=> checkAnswer(choiceText);
choiceElem.addEventListener('click', clickHandle);
choicesElem.appendChild(choiceElem);
}
Thanks!