Hide or Show DIV Element

Want to learn how to hide div element on your HTML page with javascript? Or how to dynamically show div element? You are on right place. Here you will find simple tutorial, demo and code how to toggle (hide or show) <div> element with its content. With help of javascript div visibility is dynamically changed.


More article and samples how to hide or show HTML element find on Show and hide with javascript summary.


If you are interested in some other fancy javascript effects follow the link.


Demo for hiding and showing div element:

Here is the sample HTML and Javascript code:


<b>
<script language="javascript">
function showOrHide()
{
var div = document.getElementById("showOrHideDiv");
if (div.style.display == "block")
{
div.style.display = "none";
}
else
{
div.style.display = "block";
}
}
</script>

<a href="javascript:showOrHide();">show/hide</a>
<div id="showOrHideDiv" style="display: none"><h4>Hello</h4></div>
</b>



Show demo and explanation here
Related Posts Plugin for WordPress, Blogger...