I am using jQuery to sort a list of li tags, My current code is:
var arr = [];
$("ul li").each(function() {
arr.push($(this));
});
arr.sort(cmpFunction);
$("ul").find("li").remove();
$.each(arr, function(index, item){
console.log(item.html());
});
What i'm finding with the console.log though - is I am losing the outside containing li tag (with the html5 data attributes that I want to keep)
Is there another option to .html() that will give me the objects li tag as well
I have provided a simple example of what I need here: http://jsbin.com/esalas/5