Element
- absolutize
- addClassName
- addMethods
- adjacent
- ancestors
- childElements
- classNames
- cleanWhitespace
- clonePosition
- cumulativeOffset
- cumulativeScrollOffset
- descendantOf
- descendants
- down
- empty
- extend
- fire
- firstDescendant
- getDimensions
- getElementsByClassName
- getElementsBySelector
- getHeight
- getOffsetParent
- getStyle
- getWidth
- hasClassName
- hide
- identify
- immediateDescendants
- insert
- inspect
- makeClipping
- makePositioned
- match
- next
- nextSiblings
- observe
- positionedOffset
- previous
- previousSiblings
- readAttribute
- recursivelyCollect
- relativize
- remove
- removeClassName
- replace
- scrollTo
- select
- setOpacity
- setStyle
- show
- siblings
- stopObserving
- toggle
- toggleClassName
- undoClipping
- undoPositioned
- up
- update
- viewportOffset
- visible
- wrap
- writeAttribute
hide
hide(element) -> HTMLElement
Hides and returns element
.
Examples
<div id="error-message"></div>
$('error-message').hide();
// -> HTMLElement (and hides div#error-message)
Backwards compatibility change
In previous versions of Prototype, you could pass an arbitrary number of elements to Element.toggle
, Element.show
, and Element.hide
, for consistency, this is no longer possible in version 1.5!
You can however achieve a similar result by using Enumerables:
['content', 'navigation', 'footer'].each(Element.hide);
// -> ['content', 'navigation', 'footer']
// and hides #content, #navigation and #footer.
or even better:
$('content', 'navigation', 'footer').invoke('hide');
// -> [HTMLElement, HTMLElement, HTMLElement] (#content, #navigation and #footer)
// and hides #content, #navigation and #footer.