I've been trying to get a fade in and out for a background image for a site, and I have been trying to get the background color of a div into a variable, this is what I've tried:
elem = document.getElementById('nav');
bgColor = elem.style.backgroundColor;
But once I try to alert the variable bgColor
like: alert(bgColor)
all I get alerted is empty in the text box. I've looked around on some Stack questions and I've tried everything that is told there and it doesn't seem to put the physical color into a variable.