I have a really simple external css stylesheet that has the following :
div.hideBox {
display:none;
}
So when the html page loads, the div
Because setting the div
's display
style property to ""
doesn't change anything in the CSS rule itself. That basically just creates an "empty," inline CSS rule, which has no effect beyond clearing the same property on that element.
You need to set it to something that has a value:
document.getElementById('mybox').style.display = "block";
What you're doing would work if you were replacing an inline style on the div, like this:
document.getElementById('mybox').style.display = "";