I hope the title somewhat sums up what I am trying to achieve.
Let's say I have two variables:
var one = $('div.foo, div.faa, div.fee, span, a, .all-sorts-of-objects'),
two = $('div.fii, div.foo, span, .all-sorts-of-objects-two');
And now, I want to check if objects contained within two are also contained within one. In other words, if there are any objects within both variables.
I need this so that I can set-up a non-overriding hover function (i.e. because I'm adding inline color-styles, I need to target my objects wisely). This is the logic I came up with: (note the if(one == two) which is essentially my question).
one.hover(function() {
if(one == two) { // if there is one or more objects in both variables..
$(this).css('color', 'red');
} else {
$(this).css('color', 'blue');
}
}, function() {
// ...
});
I hope I have been clear enough. If not, please let me know and I will do my best to explain this better.
Thank you very much!