【发布时间】:2012-03-17 09:46:37
【问题描述】:
我想根据他们的订单为 ul 孩子制作不同的背景颜色,我怎样才能使用 jquery 获得孩子的顺序。
<ul>
<li>a</li>
<li>b</li>
<li>c</li>
<li>d</li>
<li>e</li>
<li>f</li>
</ul>
$('ul li').bind('mouseover', function(e){
//how can I get the order of the childre
//when hover on c it shoul returns 3
alert("child order ");
});
这是一个例子 http://jsfiddle.net/sHefJ/
【问题讨论】: