【发布时间】:2018-04-12 07:02:06
【问题描述】:
当使用querySelectorAll 或任何 DOM 查询方法时,我想跳过给定子容器中的元素进行查询。
示例:
<div id="container-one">
<div>
<input type="text" name="first">
<input type="text" name="second">
<!-- skip below -->
<div id="container-two">
<input type="text" name="third">
<input type="text" name="fourth">
</div>
<div>
</div>
假设在上述情况下,如果您从#container-one 元素查询,您想跳过#container-two 中的元素。因此,#container-one 上的查询应该只返回 [first, second] 元素并跳过其他元素(第三、第四)。
感谢任何输入。
【问题讨论】:
标签: dom jquery-selectors selectors-api