Ask coding questions

← Back to all posts
Why is this null?
MikeJMS8910

So I have been working on a script - document.body.querySelectorAll(".page")[z].querySelector(".student-list").querySelector(".student-item cf") - but when I run it, it says that it is null.

here you can see the elements in the console and it shows that there is an element with the id of student-item cf. So how can I make this work? Thanks.

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
EpicCoderGuy1
MikeJMS8910
Comments
hotnewtop
Coder100

oh i see

you forgot the discrim, you need the . in front of it to say it is a class not an element!

MikeJMS8910

@Coder100 o my gosh I swear I quadruple-checked that thank you so much!

Coder100

lmao
np! @MikeJMS8910

Coder100

send the repl so we see the html