0
Why script run before html?
I write a small web sample. As i know script tag can be used fro external files. In external file i specify querySelector and getElementById but in both cases got null When i had done the same in html file everything shown perfectly, but only after js file run. May be i do something wrong?! Why? https://code.sololearn.com/W7kimA48WERQ/?ref=app
5 Réponses
+ 6
Your scripts are all correct
it's only that Sololearn put scripts in JS tab in <head>, solution will be
window.onload = function () {
your scripts
}
0
Oooo thanks!!! I will use this trick!!!!
0
I change it everything is work. Thank you
0
You are welcome. Keep up the good work 💪
0
Gordon i change with arrow function but on this platform not work!!!
but i do it for example))) so i think such situation also ok