+ 1
querySelector
What is the difference between querySelector and querySelectorAll? When is which used? greeting micha
1 Réponse
+ 16
Directed from the Mozilla documentation :
This specification adds two new methods to any objects implementing the Document, DocumentFragment, or Element interfaces:
querySelectorReturns the first matching Element node within the node's subtree. If no matching node is found, null is returned.querySelectorAllReturns a NodeList containing all matching Element nodes within the node's subtree, or an empty NodeList if no matches are found.
For reference :
https://developer.mozilla.org/en-US/docs/Web/API/Document_object_model/Locating_DOM_elements_using_selectors