+ 1

Why i am not able to use addEventListener

Error https://code.sololearn.com/W7sNh0NXq4lB/?ref=app

14th May 2020, 7:49 AM
Jagmeet Singh
Jagmeet Singh - avatar
4 Respuestas
+ 3
Js script is getting loaded before html so obviously getting the element that doesn't exist yet returns null ,to avoid this use window.onload=function(){ js code goes here } Also search for similar questions pls, you will get many more ways and much detailed answers ,it has been asked many times,
14th May 2020, 10:44 AM
Abhay
Abhay - avatar
+ 1
Thanks brother
14th May 2020, 10:46 AM
Jagmeet Singh
Jagmeet Singh - avatar
0
Thanks bro
14th May 2020, 11:04 AM
Parth Puri
Parth Puri - avatar
0
This happen only in sololearn?
14th May 2020, 11:05 AM
Parth Puri
Parth Puri - avatar