+ 2

JS Question

What is the difference between "querySelector()" and "querySelectorAll()"? I haven't been able to sleep because of it! 😩

31st Aug 2024, 2:24 AM
Bismark GC
Bismark GC - avatar
2 odpowiedzi
+ 3
Bismark GC querySelector(): Returns the first element that matches the specified CSS selector. If no match is found, it returns null. querySelectorAll(): Returns a NodeList containing all elements that match the specified CSS selector. If no match is found, it returns an empty NodeList.
31st Aug 2024, 2:50 AM
BroFar
BroFar - avatar
0
Nisha
1st Sep 2024, 5:58 AM
<3nîshî🤍
<3nîshî🤍 - avatar