If you really mean how to convert:
[$(a), $(b), $(c)]
as a result of:
$(a, b, c)
then you can use the add function to add each jQuery object to another jQuery object:
var x = $(); // empty jQuery object $.each([$(a), $(b), $(c)], function(i, o) {x = x.add(o)});
At this point, x will contain the combined jQuery object, which is a combination of the previous jQuery objects a, b, and c in the array.
I could not find a way to do this without each() loop. The add() function takes an array of DOM elements as an argument, but (at least according to the documentation ), not an array of jQuery objects.
Or you can convert each jQuery object to a DOM element, which is likely to be a little more efficient, since in the end it creates only one new jQuery object:
$([$(".a"), $(".b"), $(".c")].map(function(o) { return o.get() }));
jfriend00 Jul 29 2018-11-11T00: 00Z
source share