0
Can anybody help me with my code?
Hello :) I am new to JavaScript. I made a little game in a tutorial. On my desktop it runs without errors. In Sololearn it says: "Uncaught TypeError: Cannot read property 'appendChild' of null Line: 19". https://code.sololearn.com/W52aUO0LEzWn Can anybody help me and give me a hint? Thank you! Regards, Steffen
2 Answers
+ 3
Hi,place that code in
window.onload=function(){
Js code goes here
}
sololearn places script inside head tag ,so selecting an element before the dom loads fully raises that error
+ 1
You are awesome, thank you so much!