I just want to know if instead
$(".element1").css('background','#000'); $(".element2").css('background','#000');
You can concatenate multiple elements so that they are affected by a single command, or if there is a more efficient way:
$(".element1",".element2").css('background','#000');
source share