Search This Blog

Showing posts with label Hide HTML div tags using JavaScript Any Element. Show all posts
Showing posts with label Hide HTML div tags using JavaScript Any Element. Show all posts

Wednesday, 30 July 2014

Show/Hide HTML Tags using JavaScript

Show/Hide HTML div tags using JavaScript



<script type="text/javascript">
function showHide(divId)
{
    var theDiv = document.getElementById(divId);
    if(theDiv.style.display=="none")
  {
        theDiv.style.display="";
   }
   else
   {
        theDiv.style.display="none";
       }   
}
</script>

<input type="button" onclick="showHide('div1')" value="Test It">
<div id="div1" style="">
<h1>This is Demo</h1>
</div>