I’m struggling to get to work a simple js onclick-event on all my blog-articles. The function only applies to the first article - why?
My structure:
<?php foreach($page->children()...
<article onmouseover="hoverList()">...
</article>
<?php endforeach ?>
My script:
function hoverList() {
var img = document.querySelector('.list-article-cover ');
img.classList.toggle('list-img-hover')
}