I'm trying to use addEventListener on each li in side a list obtained from querySelectorAll, changing each item color as I hover the mouse over it. However I cannot change color by using the index of the item in the list but have to use this. I wonder why index doesnt work here
var lis = document.querySelectorAll("li");
for(var i = 0; i < lis.length; i++) {
lis[i].addEventListener("mouseover", function() {
this.style.color = "green";
});
}