🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: DOM and Events: all 10 questions

Quiz: DOM and Events · Question 6 of 10

What does document.querySelectorAll(".task") return?

What does document.querySelectorAll(".task") return?

  1. A.Only the first element with class task
  2. B.A list (NodeList) of all elements with class task
  3. C.The number of matching elements
  4. D.A copy of the HTML as a string
Answer & explanation

Correct answer: A list (NodeList) of all elements with class task

querySelector returns the first match; querySelectorAll returns all matches.

Can you get the rest right without peeking?

Take the timed Quiz: DOM and Events quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →