I'm trying to be able to check if a selector have a certain sets of classes.
.hasClass() can only check if the selector has one class. And the .is() selector can look for multiple classes but will return true if the selector have at least one of the classes.
But I wan't to achieve a way to check if a selector have both of the classes, and only if it has both of the classes do action.
Any pointers?
You can simple list the class names:
.foo.bar.bar
This selector matches any element that has all the classes foo, bar, and baz.
The is() function should work for you.
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