+ 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 Réponses
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
᠌Bidex
᠌Bidex - 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 🇮🇳
Aujourd'hui en vedette
.
1 Votes
What?
0 Votes
HTML
0 Votes
Web
0 Votes
Quiz duel
0 Votes
FRC Coding?
1 Votes
AI
2 Votes
help
0 Votes
APIs
1 Votes