简体   繁体   English

jQuery,nextUntil(),如果element不是段落

[英]jQuery, nextUntil(), if element is not a paragraph

I wanna use nextUntil() to make all p's orange which are directly following a h2.first till any other html tag than p arrives. 我想使用nextUntil()来制作所有p的橙色,它们直接跟在h2.first直到除了p之外的任何其他html标签。

<h2 class="first">Lorem ipsum</h2>
<p>Lorem ipsum</p>
<p>Lorem ipsum</p>
<p>Lorem ipsum</p>
<ul>
  <li>Lorem ipsum</li>
  <li>Lorem ipsum</li>
  <li>Lorem ipsum</li>
</ul>
<h2>
<p>Lorem ipsum</p>
<p>Lorem ipsum</p>
<p>Lorem ipsum</p>

So in this case the pragraphs are followed by an unordered list. 所以在这种情况下,pragraph遵循无序列表。 But it could also be any other html tag. 但它也可能是任何其他html标签。 My problem is to express "any other html tag than p". 我的问题是表达“除p之外的任何其他html标签”。 Is there someone out there, who knows the answer? 那里有人,谁知道答案?

-> nextUntil(**'any other html tag than p'**, 'p') - > nextUntil(**'any other html tag than p'**, 'p')

Thanks a lot in advance! 非常感谢提前!

Not can help you to do so. Not可以帮你做到这一点。 You can use this : 你可以用这个:

nextUntil(":not(p)");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM