Accessing DOM Elements

Selecting DOM Elements Using querySelectorAll

querySelectorAll will select all the HTML elements which match the provided query. This is a versatile selector and can match elements using any of the CSS selectors, including class names, tag names, id names or any complex selectors too.

The method returns

The selectors that we pass in this method are simply the CSS selectors that we have used in CSS. This means you can use # to select using the id, . to select using their class names and you can go as detailed as possible with your selectors. This can be seen in the example given above for the case of ‘inspirationConfirmation’.