JavaScript QuerySelector - par le nom de la balise

<div>This is a div element.</div>
<div>This is a div element.</div>

<button onclick="getElement()">Get element by tag name</button>

<script>
  function getElement() {
    let element = document.querySelector("div");
    element.style.background = "lightgreen";
  }
</script>
Clumsy Caiman