jQuery(this).find('title').next().next().next().eq(0).text();?

发布于 2024-10-05 18:39:14 字数 218 浏览 0 评论 0原文

更好/优雅的方法是什么?

jQuery(this).find('title').next().next().next().eq(0).text(); //THIS WORKS

我尝试使用

jQuery(this).find('title').eq(3) //DOESN't WORK

但它不...

what's the better/elegant way to do this?

jQuery(this).find('title').next().next().next().eq(0).text(); //THIS WORKS

i tried using

jQuery(this).find('title').eq(3) //DOESN't WORK

but it doesnt...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空气里的味道 2024-10-12 18:39:14

nextAll().eq(2) 怎么样?这应该是第三项。然后附加 .text() 。如果不是这样,您能提供标记吗?

What about nextAll().eq(2) ? That should be the third item. And append .text() afterwards. If that's not it, can you provide the markup?

放赐 2024-10-12 18:39:14

.eq() 正在处理链中匹配的元素集。 也是如此

jQuery(this).find('title').eq(3)

查找与 .find('title') 匹配的一组元素中的第四个

。你可能想要的是

jQuery(this).find('title').nextAll().eq(2).text()

.eq() is working on the set of matched elements in the chain. So

jQuery(this).find('title').eq(3)

is finding the 4th of a set of elements matching .find('title').

what you probably want is

jQuery(this).find('title').nextAll().eq(2).text()
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文