This question has already been answered:
There is a js code that takes an element by id (tried and by class) adds a class to it at mouseenter. The question is as follows: the code changes the first element that came to it with such an id (classo'm, although I have more than 5), how to change ALL these elements?
var one = document.querySelector('.img1'); one.addEventListener('mouseenter',function add() { one.classList.add("changes"); }); one.addEventListener("mouseleave",function remove(){ one.classList.remove("changes"); }); <div class="blockOne"><img class="img1" src="home/1.png"></div> <div class="blockTwo"><img class="img1" src="home/2.png"></div>