HTML | DOM querySelectorAll() Method
The querySelectorAll() method in HTML is used to return a collection of an element’s child elements that match a specified CSS selector(s), as a static NodeList object. The NodeList object represents a collection of nodes. The nodes can be accessed by index numbers. The index starts at 0.
Note: If we want to apply CSS property to all the child nodes that match the specified selector, then we can just iterate through all nodes and apply that particular property.
Selectors is the required field. It specifies one or more CSS selectors to match the element.These selectors are used to select HTML elements based on their id, classes, types, etc.
In case of multiple selectors, comma is used to separate each selector.
After clicking the button:
Supported Browsers: The browser supported by querySelectorAll() method are listed below:
- Apple Safari 3.1
- Google Chrome 1.0
- Edge 12.0
- Firefox 3.5
- Opera 10.0
- Internet Explorer 9.0