开发者

Why does the .index() function not work?

Example: http://jsfiddle.net/peeter/ePMFe/

It returns the index as -1, instea开发者_如何学编程d of the actual index. Any ideas are greatly appreciated.


because your jQuery array is the UL and you're searching for an LI.

console.log($("#myul li").index(tab));

should work fine


index start with 0 and u want to search the index of tab_3 then it will b 2

see the update


While this doesn't answer your actual question, you can solve the problem by using $(tab).index().

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜