Classlist of null error on JS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Classlist of null error on JS

I wrote a broken script long time ago and I thought I should post it here for help. When you play the game and click on it, the function jump isnt working https://code.sololearn.com/WfzBsC8On6E5/?ref=app

14th Apr 2021, 5:33 AM
Weird Codem
7 Answers
+ 4
1. Move the onclick to the body tag, not the html tag. 2. Wrap your initializing code in a; document.onload = ()=> { ... code here ...} So that the DOM is built when the objects are created.
14th Apr 2021, 6:05 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Without posting the code, it's not possible to provide a solution.
14th Apr 2021, 5:57 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Try to attach a link to your code, maybe it can describe the issue better. I find your Description to be rather vague and unclear contextually "when you play the game" What game? "and click on it" Click on what; "the function jump isn't working" What function? there is no code to view. Maybe it's time for practicing mind reading for me.
14th Apr 2021, 6:00 AM
Ipang
+ 1
Ipang, there. I editted it.
14th Apr 2021, 6:01 AM
Weird Codem
+ 1
See the explanation in below post https://www.sololearn.com/post/90825/?ref=app I didn't see the code when I was writing the response, sorry, intended no offense.
14th Apr 2021, 6:05 AM
Ipang
0
Ph frick, I forgot
14th Apr 2021, 5:58 AM
Weird Codem
0
There we go
14th Apr 2021, 5:59 AM
Weird Codem