How to really hide DIV tag with Javascript?

I need to show/hide a DIV section based on checkbox checked property. My first attempt was to use visibility property on element ('visibility:hidden' or 'visibility: collapse'), but it turns out that element is still taking space with no content visible inside. Solution is use of 'display: none' CSS property.
'visibility: hidden' - hides the element, but it still takes up space in the layout.
'display: none' - removes the element completely from the document, it doesn't take up any space.

No comments:

Post a Comment