JavaScript querySelectorAll() Method Tutorial

In this section, we will learn what the document querySelectorAll() method is and how to use it in JavaScript.

What is document querySelectorAll() Method in JavaScript?

The JavaScript document querySelectorAll() method is used to bring a reference of one or more elements in an HTML document to a JavaScript program using CSS Selectors.

document querySelectorAll() Method Syntax:

document.querySelectorAll(CSS-selectors);

document querySelectorAll() Method Parameters

The method takes one argument and that is a CSS-selector.

document querySelectorAll() Method Return Value

The return value of this method is a collection object that contains the entire elements in an HTML document that matched the declared CSS-selector set as the argument of this method.

Example: using document querySelectorAll() Method in JavaScript

See the Pen using document querySelectorAll() Method in JavaScript by Omid Dehghan (@odchan1) on CodePen.

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies