jQuery select a div with a certain class, that doe

2019-01-31 10:49发布

问题:

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

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

...

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

回答1:

Use :not() to exclude the other class:

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


回答2:

You can also filter out the '.no' class with something like:

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


回答3:

get the div's class name, if it has a SPACE in the class name then it means it has more than one class !