Skip to content

Instantly share code, notes, and snippets.

@yyq123
Created June 23, 2012 14:32
Show Gist options
  • Save yyq123/2978518 to your computer and use it in GitHub Desktop.
Save yyq123/2978518 to your computer and use it in GitHub Desktop.
Accordion_ToggleVisibility_Javascript
<script type="text/javascript">
/*
** Name: toggle_visibility
** Desc: toggles id of element to be visible or not
*/
function toggle_visibility(id) {
var e = document.getElementById(id);
if (e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}
</script>
<p><a title="Click to show/hide FAQ" href="javascript: toggle_visibility('FAQ1');">Question</a></p>
<div style="display: none;" id="FAQ1">
<p>Answer</p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment