Reputation: 13099
Is there a way to get jQuery slice to return an array of elements instead of a jQuery object? Perhaps an alternative function from a jQuery compatible library?
Or do I have to covert into an array myself using makeArray (or doing it myself)?
(I ask because once I discovered each2, I am always imagining there is a slightly more optimized function out there for a given task).
Upvotes: 1
Views: 202
Reputation: 227290
Use .get()
to return an "normal" array from a jQuery object.
Example:
var arr = $('div').slice(2, 4).get();
Upvotes: 5