开发者

Why does the .index() function not work?

开发者 https://www.devze.com 2023-02-24 06:49 出处:网络
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

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

精彩评论

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