Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
目前我有
alert('Index: ' + $(this).index());
在单击事件上,它会提醒元素当前位置,但仅在其父元素内,对吗?我如何使用 .index() 从整个文档中找到位置?
谢谢,
史蒂夫,
我相信您可以致电:
$('*').index($(this));
或查看它是哪个(例如,'img')...
$('img').index($(this));