Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h2>Finding HTML Elements by Query Selector</h2> <p class="intro">Hello World!</p> <p class="intro">Hello Sweden!</p> <p class="intro">Hello Japan!</p> <p id="demo"></p> <script> const myElements = document.querySelectorAll("p.intro"); document.getElementById("demo").innerHTML = "The first paragraph with class='intro' is: " + myElements[0].innerHTML; </script> </body> </html>