How to get child-index of element in prototype
If I have a structure like this:
<ul>
<li class="golden-delicious">Golden Delicious</li>
<li class="mutsu">Mutsu</li>
<li class="mcintosh">McIntosh</li>
<li class="ida-r开发者_JAVA技巧ed">Ida Red</li>
</ul>
and a selector
$$('li.mutsu')[0]
that returns an element, how can I get the index of this element within its parent child collection? I need the index value "1" of li.mutsu.
You could use .previousSiblings().size()
精彩评论