I have some h3 elements with the same class. I need to get text from h3 when i click on one of the elements.
document.querySelector(`.block__item__name`).onclick = function() {
let value = this.textContent;
console.log(value);
};
This code works with first h3 only. How can i fix it?