I'm trying to check of all the elements inserted into an array have a class. The code I have so far for the array is this:
var ids = ['#biography', '#videogallery', '#pubblications', '#contacts', '#resume'];
var currentElem = "";
function test(){
$(ids.join()).each(function() {
var currentElem = $(this);
})
};
The problem is that now I'm a bit stuck. I mean, what should I write so that an if statement check if all of the elements with the ids in the array have "test" class?
Something like:
- if #biography as class "test"
- if #videogallery as class "test"
- etc
- if all of them as the "test" class, then run a function
- if even one doesn't, then run else.
Hope it's not too confusing. Thanks in advance for any help!