+ 1
JS adding numbers understanding help
I was trying to challenge my self to make a quiz that tells you your score at the end. But I didn't know how to add them. HTML: option A B C ✔️correct answer D What I did was var x = 0; C.onclick = func...{ x+=1; score.innerHTML = x } But that just keeps adding up the score number by one every time you click on the correct answer. So how can I limit it to add one (1) only? ::pretend like there are 5 questions. I need to add up the scores correctly. If correct answer clicked, add 1, if not, -1 or -0
2 Réponses
+ 1
https://www.sololearn.com/post/129872/?ref=app
the modern ui is clicking answer and then next question is shown, like what you are trying to do. i remember ashutosh has some maths mc quiz with user experience like this.
we will proceed little by little and try to do that in #6 of this series.
meanwhile, let's learn the basics :
document.querySelectorAll
with class names or tag names
0
I have started a code, but it only has 1 question.
But if it's easier to work with the code, then I will finish it to 5 questions, (ur preference).