Skip to content

Instantly share code, notes, and snippets.

@nastanford
Last active December 6, 2019 04:24
Show Gist options
  • Save nastanford/5886693 to your computer and use it in GitHub Desktop.
Save nastanford/5886693 to your computer and use it in GitHub Desktop.
JavaScript Show Hide Scripts Samples
<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';
}
function showID(id) {
var e = document.getElementById(id);
e.style.display = 'block';
}
function hideID(id) {
var e = document.getElementById(id);
e.style.display = 'none';
}
//-->
</script>
<a href="#" onclick="toggle_visibility('foo');">Click here to toggle visibility of element #foo</a>
<div id="foo">This is foo</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment