class method Element.show
Element.show(element) → Element
Removes display: none
on element
. Returns element
.
Examples
Show a single element:
<div id="error-message" style="display:none;"></div>
$('error-message').show();
// -> Element (and displays div#error-message)
Show multiple elements using Enumerable#each
:
['content', 'navigation', 'footer'].each(Element.show);
// -> ['content', 'navigation', 'footer']
Show multiple elements using Enumerable#invoke
:
$('content', 'navigation', 'footer').invoke('show');
// -> [Element, Element, Element]
Notes
Element.show
cannot display elements hidden via CSS stylesheets.
Note that this is not a Prototype limitation but a consequence of how the
CSS display
property works.
<style>
#hidden-by-css {
display: none;
}
</style>
[...]
<div id="hidden-by-css"></div>
$('hidden-by-css').show(); // DOES NOT WORK!
// -> Element (div#error-message is still hidden!)
This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.