0
Uncaught TypeError: Cannot read property 'addEventListener' of null
I can't figure out what's going wrong with my code, why I'm getting this error? LINE 24! Please help. https://code.sololearn.com/WrbH3cGPOgBJ/?ref=app
2 Respuestas
+ 3
Try this
Window.onload= function(){
//Your js code here
}
+ 3
In normal editors like VS Code, Sublime Text, or Atom, the simplest solution is <script src="url" defer></script> but since in Sololearn code playground you don't have access to the script, the best solution is already written here by Mirielle. Or some people prefer to write the script in the HTML to the bottom of the body but I personally like the load listener more.