Ask coding questions

← Back to all posts
Why is this null?
MikeJMS8910 (234)

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 (18922) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (18922)

oh i see

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

MikeJMS8910 (234)

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

Coder100 (18922)

send the repl so we see the html