0
Error undefined
Here is my web code. It tells me menu is undefined, why? https://code.sololearn.com/WJvBk9LiVpJQ/?ref=app
5 odpowiedzi
+ 7
The JavaScript file in SoloLearn is included at the top of the html file, before the body tag is even created.
So when you run it first, there is no body tag yet, and thus the error.
If you try this in your computer, and link the JavaScript file at the bottom, it should work fine.
+ 5
Mohamed Habib you sadly can't include the JS file manually in SL, so no, it will not work.
Try to wrap it in window.onload function
+ 4
Mohamed Habib here is an example:
https://code.sololearn.com/Wo4Uo2Bk0izt/?ref=app
+ 2
Ok thanks a lot 👌
+ 2
Aymane Boukrouh [INACTIVE]
Thanks !!