+ 1
Weird behavior of javascript or html
Strange behavior of top body or head or external script. https://code.sololearn.com/WM4PAFEmuBI5
2 ответов
+ 7
HTML script is loaded from beginning to end.
When the JS codes are in <head> or beginning of <body>, the elements are not created yet, so the get elements function returns null.
0
First load the body/document then load js to let the dom work properly.
Use script as last tag inside body tag.