querySelector
The method querySelector() returns the first Element within the document that matches the specified selector, or group of selectors. If no matches are found, null is returned.
Querys
Symbol
Query
#
id
.
class
<blank>
tag
Example
document.querySelector("#id") // Returns the FIRST element with the ID of iddocument.querySelector(".id") // Returns the FIRST element with the className of iddocument.querySelector("label") // Returns the FIRST element that is a LABELLast updated
Was this helpful?