开发者

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()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜