With:
if(element.hasClass("class"))
I can check for one class, but is there an easy way to check whether "element" has any of many classes?
I am using:
if(element.hasClass("class") || element.hasClass("class") ... )
Which isn't too bad, but I am thinking of something like:
if(element.hasClass("class", "class2")
Which unfortunately doesn't work.
Is there something like that?
use default js match() function:
to use variables in regexp, use this:
by the way, this is the fastest way: http://jsperf.com/hasclass-vs-is-stackoverflow/22
works, but it's 35% slower than
If you doubt what i say, you can verify on jsperf.com.
Hope this help someone.
How about this?
This worked for me:
How about:
filter() is another option