开发者

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&开发者_Python百科gt;
<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)?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜