0
What's the error ['Solved']
3 Respostas
+ 5
https://code.sololearn.com/WamWDjbVaSno/?ref=app
+ 2
Abhishek Singh
As your JS code is running even before the document has loaded, it throws an error that there is no such element.
As suggested by Aymane Boukrouh , you need to wrap the entire js code inside a function which runs only after the Window is loaded.
+ 2
Aymane Boukrouh Thank you for the code
Hanuma Ukkadapu Thank you for explanation