Hide 'div' tag in JavaScript

dreamweaver, html, javascript

Solution

Use:

document.getElementById("div").style.display = 'none';

Problem

I have JavaScript code that hides a tag when it is clicked: ``` document.getElementById("div").style.visibility="hidden"; ``` Although when I do this, even though the div tag is hidden, there is still a space where the div tag is located. how do I collapse the whole div tag using JavaScript?

Original source