I have the following style defined for an element with ID #foo.
#foo {
display: none;
}
I run the following JavaScript code:
var foo = document.getElementById('foo')
alert('[' + foo.style.display + ']')
I was expecting the output to be [none]
. However, the output is simply []
. Here is a demo: http://jsfiddle.net/bEmUE/
Why is foo.style.display an empty string here?
What can I write in the code to figure the actual display property of this element?