I have two comma-separated selectors;
.class, .foo, .bar
.lorem, .ipsum, .potato
I'd like to be able to select any possible combination between these two groups. So it would select elements matching
.class.lorem
.class.ipsum
.class.potato
.foo.lorem
.foo.ipsum
.foo.potato
.bar.lorem
.bar.ipsum
.bar.potato
How can I achieve this effectively?
Select all elements with any class from the first set, and then filter out the elements which don't have a class from the other set:
$('.class, .foo, .bar').filter('.lorem, .ipsum, .potato')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With