简体   繁体   中英

jQuery select a div with a certain class, that doesn't have another class

<div class="fuu">
  ...
</div>

<div class="fuu no">
  ...
</div>

...

How can I select all fuu 's besides the ones that have the .no class?

使用:not()排除其他类:

$('.fuu:not(.no)')

您还可以使用以下内容过滤掉'.no'类:

$('.fuu').not('.no');

获取div的类名,如果它在类名中有一个SPACE则表示它有多个类!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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