accessing HTML properties set by CSS class

xilo

New Member
I'm trying to set up something simple to show/hide a \[code\]<div>\[/code\] when something else is clicked. I was setting the \[code\]display\[/code\] property in a CSS class applied to the dynamic \[code\]<div>\[/code\]. I found that the \[code\]div.style.display\[/code\] 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 \[code\]display\[/code\] explicitly on the tag in this case so I have a value to query?
 
Back
Top