As a matter of organization and performance, I often use multiple selectors together to perform a jquery method. For example:
$("#bola, #casa, #arvore").css("background-color", "blue");
This example works because the selector is a string.
However when using objects I do not know how to do this join.
New scenario:
var bola = $("#bola");
var casa = $("#casa");
var arvore = $("#arvore");
$(bola, casa, arvore).css("background-color", "blue");
In this case only the "ball" background is painted.
Or concatenating with a comma:
$(bola+ ","+ casa + "," + arvore).css("background-color", "blue");
In this case neither is painted, as expected.
Then I would like to know if there is any way to merge these objects by a comma or somehow that they are in the same selector.
Test Fiddle: link