A moment ago I asked this question: javascript sort array to align with order array based on what turned out to be a false premise. (I\'ve been up for too long, give me a br
I know this is late, but maybe it will help someone. I was trying to do a similar thing and #Felix Kling's answer got me 90% there. But in my case I have a div id which is equal to the order values, like this:
order = [3,1,4,0,2];
Jack
Jill
Nancy
Tom
Cartman
then I can simply push the element using the position value
var elements = [];
$.each(order, function(i, position) {
elements.push($('#'+position));
});
$('#moduleWrap').append(elements);