Category: >> JavaScript >> Hide/Show div Bookmark and Share

<< lastnext >>

Snippet Name: Hide/Show div

Description: Toggles the display of a div (can also be used on a SPAN).

Comment: (none)

Author: CoderZone
Highlight Mode: JAVASCRIPT
Last Modified: March 01st, 2009

< s c ript type="text/javascript">
function toggle_div(id) {
     var diq = document.getElementById(id).style;
     diq.display=(diq.display=="none") ? "" : "none";
<!-- Example usage -->
<a href="javascript:toggle_div('hideshow')">Hide/show</a>
<div id="hideshow">
     <h1>Example text to hide or show</h1>
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© | users online: 10