jQuery selector: Selecting a certain combination of classes when multiple exist

I have tried to do some research already and haven’t found anything, but If I’ve missed the answer, please tell me. Basically I have multiple elements with multiple classes each, but the combinations are unique. I want to select a certain combination of classes, but not other elements that have this elements in combination with others.

I would like to know if this selector exists in jQuery or if there is some other way to accomplish what I am explaining. See the example below:

<div class="a b c"></div>
<div class="a b c d"></div>
<div class="a b c d">/div>

When trying to log only the element with the classes a b c, I tried using:

$('.a.b.c').each( function() {

the output is:

[ <div class="a b c">...</div> ,
<div class="a b c d">...</div ,
<div class="a b c d">...</div> ]

I am looking for the output to be:

[<div class="a b c">...</div>]


You could use the CSS3 :not() pseudo class to negate the .d class: (example)

$('.a.b.c:not(.d)').each( function() {

jQuery also has a .not() method: (example)

$('.a.b.c').not('.d').each( function() {

You could also use the attribute selector: (example)

  [class="a b c"]

Note that the order always has to be a b c. Just throwing that out there as an option.