Cannot read property 'addEventListener' | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Cannot read property 'addEventListener'

Uncaught TypeError: Cannot read property 'addEventListener' of null

22nd Jun 2021, 2:16 PM
aslam Sidheeq
5 Answers
+ 3
element=document.querySelector("#btn"); querySelector use css selector syntax ;)
22nd Jun 2021, 2:24 PM
visph
visph - avatar
+ 1
you probably attempt to access a dom element either wich doesn't exist or is not available when getting its reference... without your code, enumerating all possible solutions would be too long: share a link to it ^^
22nd Jun 2021, 2:21 PM
visph
visph - avatar
22nd Jun 2021, 2:23 PM
aslam Sidheeq
0
Not able to understand and debug even from previous asked questions.
22nd Jun 2021, 2:17 PM
aslam Sidheeq
0
oh man 😍👍
22nd Jun 2021, 2:26 PM
aslam Sidheeq