JQuery / CSS requires multiple classes

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

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

I can say that I need elements that apply to both class 1 and class 2 (so in this case you only need to get the third div)?

+4
source share
1 answer

The selector you are looking for is .class1.class2

For more information, see the specification: http://www.w3.org/TR/CSS2/selector.html#class-html

+11
source

Source: https://habr.com/ru/post/1334020/


All Articles