class method Element.identify
Element.identify(element) → String
Returns element
's ID. If element
does not have an ID, one is
generated, assigned to element
, and returned.
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>
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.