I\'m trying to sort a list of divs with jQuery. Essentially the list might look like this:
Some thing along these lines should work:
var list = [];
function sortDivs(a,b)
{
return parseInt(a.text(), 10) - parseInt(b.text(), 10);
}
$('contest_entry').each(function () {
list.push(this);
$(this).detach();
})
list.sort(sortDivs)
for (var x = 0; x < list.length; x++) {
$('#parent_el').append(list[x]);//where parent_el is the place you want to reinsert the divs in the DOM
}