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
siblings
siblings(element) -> [HTMLElement...]
Collects all of element’s siblings and returns them as an array of extended elements.
Two elements are siblings if they have the same parent. So for example, the head
and body
elements are siblings (their parent is the html
element).
The returned array reflects the siblings order in the document (e.g. an index of 0 refers to element
’s topmost sibling).
Note that all of Prototype’s DOM traversal methods ignore text nodes and return element nodes only.
Examples
<ul>
<li id="golden-delicious">Golden Delicious</li>
<li id="mutsu">Mutsu</li>
<li id="mcintosh">McIntosh</li>
<li id="ida-red">Ida Red</li>
</ul>
$('mutsu').siblings();
// -> [li#golden-delicious, li#mcintosh, li#ida-red]