Closed keithknox closed 9 years ago
Give this a whirl:
var squares = document.querySelectorAll(".square");
for(var x = 0; x < squares.length; x++){
var square = squares[x]; // This gives you the current square element
square.addEventListener("mouseover", function(){
});
square.style.backgroundColor = "whatever";
}
Many other people got stuck on the same thing!
completeness: 2.5-3ish comfort: same.
i got stuck trying to create a click event for the squares. I thought following the same pattern for setting the brush would work but the change would be iterating over the squares. it didn't work out.