https://developer.mozilla.org/fr/docs/Web/API/Document/getElementsByClassName
Sélectionner des éléments par leurs “class”
<body> <div> <p>hello word1</p> <p class="test">hello word2</p> <p >hello word3</p> <p>hello word4</p> </div> <script> var test=document.getElementsByClassName("test"); console.log(test); //HTMLCollection[1] var testTarget=document.getElementsByClassName("test")[0];//here , this element is target console.log(testTarget); //<p class="test">hello word2</p> </script> </body>