I want to make an event where .gridss change colors with mouseover event. Problem is gridss comes out as not definied,and if i try to move the mouseover event into the the gridss function it also does not work. So how can I successfully refer to .gridds?
My question is pretty simple yet i cant seem to get it right,so thanks in advance.
const container = document.querySelector('#container');
$(document).ready(function() {
for(var x = 0; x < 16; x++) {
for(var y = 0; y < 16; y++) {
let gridss = $("<div class='gridss'></div>");
gridss.appendTo('#container');
}
}
});
gridss.addEventListener("mouseover", function( event ){
event.target.style.color = "purple";
setTimeout(function(){
event.target.style.color = "";
}, 10);
}, false);