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
identify
1.6
identify(element) -> id
returns element
’s id
attribute if it exists, or sets and returns a unique, auto-generated id
.
Examples
Original HTML
<ul>
<li id="apple">apple</li>
<li>orange</li>
</ul>
JavaScript
$('apple').identify();
// -> 'apple'
$('apple').next().identify();
// -> 'anonymous_element_1'
resulting HTML
<ul>
<li id="apple">apple</li>
<li id="anonymous_element_1">orange</li>
</ul>