Why is this code not working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is this code not working?

It says 'Uncaught TypeError: Cannot read property 'style' of null Line_3' Here is the code https://code.sololearn.com/WB8pAjtZbmPZ/#html

29th Sep 2020, 5:17 PM
Leon Shrestha
Leon Shrestha - avatar
2 Answers
+ 4
change your class to id and it works(in line 8 and line 23 html section) OR Only change getElementById to querySelector in the JS section and it works.
29th Sep 2020, 6:00 PM
Rohit
0
thx
3rd Oct 2020, 6:15 PM
Leon Shrestha
Leon Shrestha - avatar