Следите за новинками
в нашем Telegram канале. Жми, чтобы подписаться:)
147 of 264 menu
◀ ▶

querySelectorAll method

The querySelectorAll method allows you to get page elements by an arbitrary CSS selector. It will be possible to perform various manipulations with the received elements: change their text, attributes, CSS styles, and so on.

Syntax

document.querySelectorAll(selector);

Example

Let's get all elements with the class www and change their text using the textContent property:

<p class="www">elem 1</p> <p class="www">elem 2</p> <p class="www">elem 3</p> let elems = document.querySelectorAll('.www'); for (let elem of elems) { elem.textContent = '!!!'; }

The code execution result:

<p class="www">!!!</p> <p class="www">!!!</p> <p class="www">!!!</p>

See also

← →
↑
English▼
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline