Check if a selector have a certain set of classes

Posted by emilolsson on Stack Overflow See other posts from Stack Overflow or by emilolsson
Published on 2010-04-19T14:58:59Z Indexed on 2010/04/19 15:03 UTC
Read the original article Hit count: 220

Filed under:
|
|

Hello

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?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about class