Possible Duplicate:
How to access css properties in javascript when applied via external CSS file?
How do i get a computed style?
I'm trying to set up something simple to show/hide a <div>
when something else is clicked. I was setting the display
property in a CSS class applied to the dynamic <div>
. I found that the div.style.display
property is not set to the initial class value the first time I check it. I'm guessing that things are working correctly and that since I did not specifically apply the style to the tag in HTML, that it is not set when my JS executes. Would it be common practice to set display
explicitly on the tag in this case so I have a value to query?