Select items with multiple classes

Select items with multiple classes

Hi,

I have some HTML like this:

  1. <div class="one two three"></div>
  2. <div class="one three"></div>
  3. <div class="two three"></div>


I want to be able to highlight all of the divs which contain both the classes 'two' and 'three'.  So the first and the third divs above are highlighted but the second isn't because it doesn't contiain both classes.

I can see how to select multiple classes like this:

  1. $('.two, .three').css('background',''yellow');


This selects items with either 'two' or 'three' classes.  I want it only to select the items with both classes.

Can anyone suggest how to do this?

Thanks all!