I need to have a score counter. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I need to have a score counter.

I had made a Spoof Quiz game. I know it is badly designed but I hadn't made it for game purpose but for backend. Problem:- The score counter os not working. Please help me out by either correcting my code or plzz just make a score counter in JS. THANK YOU This is the code. - https://code.sololearn.com/WaN82PBriamt/?ref=app

17th Mar 2019, 5:29 AM
Sarthak Gupta
Sarthak Gupta - avatar
2 Answers
+ 4
There are few mistakes, typo on incorrect.. I have added onload callback for init codes run, set global vars and corrected some typo for you... https://code.sololearn.com/Wrz8j6gI9NG2/?ref=app
17th Mar 2019, 6:42 AM
Calviղ
Calviղ - avatar
+ 4
It should be document.getElementsByClassName("score_t")[0].value And dom access function cannot be called directly from JS pane, dom is not ready to access. Use window.onload callback.
17th Mar 2019, 6:26 AM
Calviղ
Calviղ - avatar