Created
October 30, 2009 11:58
-
-
Save jakearchibald/222287 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<div id="hideLinkContainer"></div> | |
<div id="stuffToToggle">Hello!</div> | |
<script type="text/javascript"> | |
// we create the show / hide link in JavaScript so it isn't there for | |
// users with JavaScript disabled | |
var showHideLink = glow.dom.create('<a href="#">Hide</a>').appendTo('#hideLinkContainer'); | |
var stuffToToggle = glow.dom.get('#stuffToToggle'); | |
glow.events.addListener(showHideLink, 'click', function() { | |
if (showHideLink.text() == 'Hide') { | |
stuffToToggle.hide(); | |
showHideLink.text('Show'); | |
} else { | |
stuffToToggle.show(); | |
showHideLink.text('Hide'); | |
} | |
// cancel the default click action | |
return false; | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment