Imagine you have the following three jQuery objects a, b, c, how would you for example set identical attributes on all of them without repeating too much code as I'm currently doing:
a.attr({
"first": "sameFirst",
"second": "sameSecond",
"third": "sameThird",
});
b.attr({
"first": "sameFirst",
"second": "sameSecond",
"third": "sameThird",
});
c.attr({
"first": "sameFirst",
"second": "sameSecond",
"third": "sameThird",
});
Isn't there something like:
$(a, b, c).attr({
"first": "sameFirst",
"second": "sameSecond",
"third": "sameThird",
});
?
EDIT: Now that I learned I can either use .add() or $() with an array of non-jQuery objects, I wonder why $(a, b, c) isn't supported because the other solutions to me seem unnecessarily verbose or convoluted.
.add()method. Take a look at the DOCS.add, though. (Not the other options available.)