How to retrieve the display property of a DOM element?

The .style.* properties map directly onto the style attribute, not to the applied style. For that you want getComputedStyle.

I’d give serious consideration to toggling .className and separating the presentation from the logic entirely.

Leave a Comment