instance method Element#show

View source on GitHub →

Element#show() → Element

Removes display: none on element. Returns element.


Show a single element:

<div id="error-message" style="display:none;"></div>
// -> Element (and displays div#error-message)

Show multiple elements using Enumerable#each:

['content', 'navigation', 'footer'].each(;
// -> ['content', 'navigation', 'footer']

Show multiple elements using Enumerable#invoke:

$('content', 'navigation', 'footer').invoke('show');
// -> [Element, Element, Element]
Notes 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.

  #hidden-by-css {
    display: none;
 <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.