Return to Snippet

Revision: 25383
at March 29, 2010 14:12 by benrudolph


Updated 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>

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

Revision: 25382
at March 29, 2010 14:10 by benrudolph


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>
<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://blog.movalog.com/a/javascript-toggle-visibility/

Initial Description

                                

Initial Title
Toggle Visibility

Initial Tags
javascript

Initial Language
JavaScript