div id toHide some content div href javascript hide Hide div script va

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<div id="toHide">some content</div>
<a href="javascript:hide();">Hide div</a>
<script>
var hidden;
function hide() {
if (!hidden) {
document.getElementById("toHide").style.display = "none";
hidden = true;
} else {
document.getElementById("toHide").style.display = "block";
hidden = false;
}
}
</script>