Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery/CSS require multiple classes

Is it possible in jQuery or CSS (since I think they use the same selector logic) to say select elements that have multiple classes. For example:

<div class='class1'></div>
<div class='class2'></div>
<div class='class1 class2'></div>

Is there a way I can say I want elements that are of both class1 and class2 (therefore only get the third div in this case)?

like image 712
jhchen Avatar asked Jan 03 '11 00:01

jhchen


1 Answers

The selector you are looking for is .class1.class2

For more info, check out the spec: http://www.w3.org/TR/CSS2/selector.html#class-html

like image 111
Šime Vidas Avatar answered Oct 12 '22 03:10

Šime Vidas