0

First time using js's DOM, can u guys help me why does this code have a mistake? + rewrite the correct syntax

https://code.sololearn.com/WYvG5X9mgj5L/?ref=app

1st Dec 2018, 7:25 AM
mmm...
mmm... - avatar
3 odpowiedzi
1st Dec 2018, 8:46 AM
Rstar
Rstar - avatar
+ 3
The problem is that (in your case) js is loaded before your html element and, because you try to access to an element in your js code, you will get a null reference... Read run and follow execution of this code and you will understand https://code.sololearn.com/WlA8Fx8bl6nI/?ref=app
1st Dec 2018, 8:50 AM
KrOW
KrOW - avatar
+ 1
Thx for your "enlightenment", Rstar :)
1st Dec 2018, 9:03 AM
mmm...
mmm... - avatar