I am trying to capture the DISPLAY div property on a page. I can only seem to capture it if it was set via the built-in style attribute.
If my JS is this:
alert(document.getElementById('myDiv').style.display);
It will warn the “block” using this HTML:
<div id="myDiv" style="display: block;"></div>
However, if I installed it through an external stylesheet:
#myID {display: block}
and my HTML:
<div id="myDiv"></div>
then my warning is an empty string.
Why is this?
source share