<p class="title">hello world 1</p>
const test = document.getElementsByClassName("title");
console.log(test); //HTMLCollection[1]
const testTarget = document.getElementsByClassName("title")[0]; // the first element, as we wanted
console.log(testTarget); //<p class="test">hello world 2</p>
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.