Element.hide sets an element’s display property to ‘none’. Using this you can hide an element from view (and effectively remove it from the flow of the page).
Element.hide( element );
element can be any DOM Element object or an ID.
<p id="desc">An adept sycophant hides in his hole.</p>
<a href="#" onclick="Element.hide('desc'); return false;">Hide the description</a>
creates:
An adept sycophant hides in his hole.
To hide and show multiple elements, use the each-method on an array:
<p id="desc1">first adept sycophant hides in his hole.</p>
<p id="desc2">second adept sycophant hides in his hole.</p>
<p id="desc3">third adept sycophant hides in his hole.</p>
<a href="#" onclick="['desc1', 'desc2', 'desc3'].each(Element.hide); return false;">Hide these descriptions</a>
<a href="#" onclick="['desc1', 'desc2', 'desc3'].each(Element.show); return false;">Show these descriptions</a>
creates:
Hide these descriptions
Show these descriptions
first adept sycophant hides in his hole.
second adept sycophant hides in his hole.
third adept sycophant hides in his hole.