Does the .add()
method allow selecting multiple objects in one go instead of adding one at a time?
one.add(two).add(three).add(four).on("click", function() { });
The following variables are set in the way they do because each carries a different function.
var one = $("#1");
var two = $("#2");
var three = $("#3");
var four = $("#4");
But what if I want to add an extra function that applies to all of these elements? Do I have to add them one by one?
I know you can select them all using $("#1,#2,#3,#4")
, but I just want to make use of the above variables.