Is it possible to feed jQuery a list of unique classes and have a jQuery set returned with the elements in the same order given. It seems the default is to return in DOM order.
Pass in an array of DOM nodes into the jQuery constructor to guarantee the order. Here's one way of doing it:
$($.map(array_of_selectors, function(selector) {
return $.makeArray($(selector));
}));
You could replace the call to $ with document.getElementsByClassName, as both results would be converted into an array of elements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With