Return to Snippet

Revision: 20509
at November 17, 2009 12:03 by fackz


Initial Code
<script type="text/javascript">
<!--
    function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }
//-->
</script>

Inline usage:
<a href="#" onclick="toggle_visibility('foo');">Click here to toggle visibility of element #foo</a>
<div id="foo">This is foo</div>

Initial URL
http://css-tricks.com/snippets/javascript/showhide-element/

Initial Description

                                

Initial Title
Toggle (Show/Hide) Element

Initial Tags

                                

Initial Language
JavaScript