JavaScript Document own method: querySelector()
[this page | pdf | back links]
The querySelector() method (when applied
to the document object of the JavaScript
DOM) returns
first (child) element that matches specified CSSSelector.
It
has the following syntax with the following parameters. It returns the
object representing the first element that matches the specified CSSSelector, or null if no
matches are found. If the selector(s) is invalid then
it throws a SYNTAX_ERR exception.
document.querySelector(CSSSelectors)
Parameter
|
Required / Optional
|
Description
|
CSSSelectors
|
Required
|
String specifying one
or more CSSSelectors. For multiple selectors, separate each one with a
comma.
|
NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)