1const allSpanElements = document.querySelectorAll('span');
2
3allSpanElements.forEach((spanElement) => {
4 // Here comes the Code that should be executed on every Element, e.g.
5 spanElement.innerHTML = "This Content will appear on every span Element now";
6});
1var container = document.querySelector("#test");
2var matches = container.querySelectorAll("div.highlighted > p");
1<article class="article first">
2 <div class="wrapper">
3 <div class="oferts">
4 <div class="pro"></div>
5 <h1>This is the Pro Version</h1>
6 </div>
7 <div class="oferts">
8 <div class="normal"></div>
9 <h1>This is the normal Version</h1>
10 </div>
11 </div>
12</article>
13
14
15// You will get a NodeList as Output
16// Try to do : console.log(typeof(oferts)) And you will see the type
17<script>
18var articleFirst = document.querySelectorAll("article.first");
19console.log(articleFirst)
20var oferts = articleFirst[0].querySelectorAll(".oferts");
21console.log(oferts)
22</script>