var cards = document.querySelectorAll(".card"); for (let index = 0; index < cards.length; index++) { const card = cards[index]; card.addEventListener("mouseover",function(){ var chils = this.childNodes for (let i = 0; i < chils.length; i++) { let e = chils[i]; if(e.nodeType==1 && e.classList.contains(‘card-info‘)){ e.classList.remove("fontDown"); e.classList.add("fontUp"); } } },false) card.addEventListener("mouseout",function(){ var chils = this.childNodes for (let i = 0; i < chils.length; i++) { let e = chils[i]; if(e.nodeType==1 && e.classList.contains(‘card-info‘)){ e.classList.remove("fontUp"); e.classList.add("fontDown"); } } },false) }