jquery - 从不是jQuery中祖 parent 的前两个 child 的 parent 中选择不是h3的 child 节点

标签 jquery css css-selectors

container 是我的主要部分,process 紧随其后。 process 由许多 parent_node 组成,每个 parent_node 都有不同的子节点(但是都有 h3)。

我想从不是祖 parent 的前两个 child 的 parent 那里选择不是 h3 的 child 节点。

我尝试过的:

$(('.container > .process > .parent_node.slice(2) > :not(h3)')

如何更正上述内容?

最佳答案

我相信一个简单的 nth-child 应该可以解决问题:

.container > .process > .parent_node:nth-child(n + 3) > :not(h3)

关于jquery - 从不是jQuery中祖 parent 的前两个 child 的 parent 中选择不是h3的 child 节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54230271/

相关文章:

javascript - offset().top 与窗口顶部的偏移量

javascript - 使用 querySelectorAll()。方法返回的结果是否有序?

html - 使用 CSS 定位文本节点

javascript - 如何使文本框增长到其父div的宽度

javascript - 我在文档上使用 jquery keydown 事件时收到 (TypeError jQuery),它导致触发大量事件,而不仅仅是选定的事件

javascript - jCarousel 的羽毛剪贴蒙版

html - CSS下拉菜单后面的模糊过滤器

css - 理解第 n 个 child (an + b): selector with formula in CSS3?

jquery - 如何通过 jQuery 将类添加到按钮组中的一个按钮?

javascript - Backbone js 不使用 fetch() 用数据填充模型