- $("ul > li").click(function () {
- var index = $(this).prevAll().length;
- });
- //如果用的是jquery1.4,明河推荐使用以下方法:
- $("ul > li").click(function () {
- var index = $(this).index();
- });
- //该片段来自于http://www.codesnippet.cn/detail/211220121130.html
来源: http://www.codesnippet.cn/detail/211220121130.html