I'm making a pixel art maker, and I want to have a color palette that users can get colors from. I have an event that listens for users clicking a div in the color palette, but when I try to access the background color of the div, it just gives me plain white.
function listenColors() {
let colors = document.querySelectorAll('.colors');
colors.forEach((member) => {
member.addEventListener('click', function() {
color = member.style.backgroundColor;
});
});
}
Does .style.backgroundColor not access the actual background color?