This is a wrapper around document.querySelector().
document.querySelector()
This looks for elements matching the query string. This ensures that exactly one element matches the query string, and that element has the expected type.
What to search for. E.g. "#main p:first-child"
"#main p:first-child"
The expected type. E.g. HTMLParagraphElement
HTMLParagraphElement
Where to look for the element. Defaults to window.document.
window.document
The new element.
If we don't find the object, we find multiple matching objects or we find an object of the wrong type.
This is a wrapper around
document.querySelector().This looks for elements matching the query string. This ensures that exactly one element matches the query string, and that element has the expected type.