This example shows how to show and hide Node
instances.
lorem ipsum dolor sit
Showing a Node
By default, Node instances are hidden using the CSS display
property. Calling the show
method displays the node.
Y.one('#demo').show();
Hiding a Node
The opposite of show
, the hide
method sets the node's CSS display
property to none
.
Y.one('#demo').hide();
Complete Example Source
<button id="hide">hide</button> <button id="show">show</button> <div id="demo"><p>lorem ipsum dolor sit</p></div> <script type="text/javascript"> YUI().use('node', function(Y) { Y.delegate('click', function(e) { var buttonID = e.currentTarget.get('id'), node = Y.one('#demo'); if (buttonID === 'show') { node.show(); } else if (buttonID == 'hide') { node.hide(); } }, document, 'button'); }); </script>