I need to change the background of one of my main container divs with Javascript. The end goal is to apply a gradient but I'm having issues just changing background color. Here's the code:
var main = document.getElementById("main");
main.parentNode.style.maxWidth = 0;
main.parentNode.style.maxHeight = 0;
main.parentNode.style.margin = "0px";
main.style.backgroundColor = "black";
This is what the tag looks like in the browser once the page loads and the JS executes.
<div id="main" style="z-index: 10; position: relative; top: 0px; left: 0px; background-color: black;">
I am not getting any JS errors. The JS is executing bc other code runs and the background color is changed in the code but not rendered. The browser I am most concerned about is Safari but I am getting the same effect in Chrome. Any help would be much appreciated.
EDIT: Here's a fiddle: http://jsfiddle.net/hz7AR/