Created
December 19, 2014 17:32
-
-
Save AndrewStanton94/832e0daa6360578eb206 to your computer and use it in GitHub Desktop.
Use to hide or show an element.
Requires button to toggle, element to hide and label for button.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flipHSpara(btn, para, label) | |
{ | |
var button = document.getElementById(btn); | |
var parastyle = document.getElementById(para).style; | |
label = label || ''; //http://javascript.info/tutorial/arguments | |
if (parastyle.display==='none') | |
{parastyle.display='block'; button.value='Hide ' + label ;} | |
else | |
{ | |
parastyle.display='none'; button.value='Show ' + label; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment