gpt4 book ai didi

jquery - 从整个文档中获取 .index() 位置?

转载 作者:行者123 更新时间:2023-12-01 01:17:48 26 4
gpt4 key购买 nike

目前我有

alert('Index: ' + $(this).index());

在单击事件上,它会提醒元素当前位置,但仅在其父元素内部,对吗?我如何使用 .index() 来查找整个文档中的位置?

谢谢,

史蒂夫,

最佳答案

我相信你可以打电话:

$('*').index($(this));

或者查看它是哪一个(例如“img”)...

$('img').index($(this));

关于jquery - 从整个文档中获取 .index() 位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10134416/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com