+ 3
Can anybody help me with this code, please?
2 Respostas
+ 6
in SoloLearn, the codes in JS section are merged with html as a single file in the top while executing.
so if ur trying to access Dom elements in ur js code, then browser would do that before loading of html itself, which causes that error.
hence we do any DOM related manipulation after the body of html is loaded
+ 2
It worked! Thanks! Why is window.onload so important? I tried on notepad++ and the code run perfectly without it...