Is there any elegant way of turning [$(div), $(span), $(li)]
into $(div, span, li)
?
What I need is a jQuery-wrapped set of elements instead of
jQuery's map() function is perfect for reshaping arrays and/or jQuery collections.
So, given an array set like so:
var arrayOfJQ_Objects = [$("div"), $("span"), $("li")];
This one line of code is all you need (See it in action at jsFiddle):
$(arrayOfJQ_Objects).map (function () {return this.toArray(); } );
Resulting in this console display in Firebug:
jQuery(div, span, li)
Reference, also, jQuery's .toArray() function.