Reputation: 1421
Is there a way to define two elements in one variable.
For example:
var replacer = $(".ir a") && $(".tk a");
Upvotes: 0
Views: 1826
Reputation: 253416
var replacer = $('.ir a, .tk a');
Or:
var replacer = $('a').filter(function(){
return $(this).closest('.ir').length || $(this).closest('.tk').length
});
References:
Upvotes: 4