Hi, I am trying to check if an element has classes that I find ex:<span class="foo bar me"></span>
I want to check if a class is fooalso present mefor this element, so I used this:
$('body span').hasClass('me', 'foo')
this foo and me are stored in an array, but this one does not work:
var arrayName = ['me', 'foo'];
$('body span').hasClass(arrayName)
the classes that I find are dynamic, so they are stored in an array, how do I pass a dynamic array, like this one 'me', 'foo', to the hasClass function?
Note: an array can have 2-4 values.
I had my work here: https://jsfiddle.net/pcbttntk/
Thanks at Advance.
Update: $('body span').hasClass('me', 'foo') does not work, thanks to Brett and Roko, he only checks the first class passed to him.