+ 1

Am trying to select html elements using document.querySelector but i get "null" as a result...

https://code.sololearn.com/W5Z1ax4W1xo7/?ref=app

28th Sep 2020, 12:58 PM
chinaza
chinaza - avatar
4 Antworten
28th Sep 2020, 1:13 PM
Abhay
Abhay - avatar
+ 1
Mind to share that troubling code? (Edit) Code link attached 👍 Here's how to do that 👇 https://www.sololearn.com/post/75089/?ref=app
28th Sep 2020, 1:06 PM
Ipang
+ 1
wrap your code in a window.onload function, your js is executing before the dom has loaded
28th Sep 2020, 1:25 PM
᠌᠌Code X
᠌᠌Code X - avatar
0
chinaza Aa said by @Brains[Bindex] Add Like this, js code : window.onload = ()=> { let ele = document.querySelector(".p1"); console.log(ele); }
28th Sep 2020, 1:44 PM
Jayakrishna 🇮🇳