Uncaught TypeError: Cannot read properties of null (reading 'addEventListener') | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')

why facing like this error message

10th Feb 2022, 2:32 AM
MANIKANDAN S
MANIKANDAN S - avatar
2 Answers
+ 3
Can you share your code here? Save it on the code playground and share it's link here. Most probably it's happening because you are trying to run your Javascript before the HTML has loaded. In this case, you can wrap your JavaScript code inside window.onload=function(){ ........ } to solve this
10th Feb 2022, 3:03 AM
Rishi
Rishi - avatar
+ 1
Rishi thank you for the response..
10th Feb 2022, 3:05 AM
MANIKANDAN S
MANIKANDAN S - avatar