jQuery 影响父元素之外的类
是否有一个 jQuery 函数可以选择某个类的所有 DOM 元素,这些元素位于使用 $(this)
选择的元素的父元素之外?
谢谢,
詹姆斯
Is there a jQuery function to select all DOM elements of a certain class that are outside the parent(s) of an element selected with $(this)
?
Thanks,
James
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
.not()
排除祖先(通过 < a href="http://api.jquery.com/parents/" rel="nofollow">.parents()
),如下所示:You can use
.not()
to exclude the ancestors (gotten via.parents()
), like this: