How can I select an element with multiple classes?
I want to select all the elements that have the two classes
So, only the elements that have both classes.
When I use
$(".a, .b") it gives me the union, but I want the intersection.
- asked 7 years ago
- B Butts
If you want an intersection, just write the selectors together without spaces in between.
So for an element that has an ID of
a with classes
c, you would write:
- answered 7 years ago
- Gul Hafiz