I\'m trying to sort a list of divs with jQuery. Essentially the list might look like this:
$(function(){
var sortedList = $('.contest_entry').toArray().sort(function(lhs, rhs){
return parseInt($(rhs).children("span.votes").text(),10) - parseInt($(lhs).children("span.votes").text(),10);
});
//the variable 'sortedList' holds the divs ordered. All you need to do is place them in the DOM.
});
Here is a working example: http://jsfiddle.net/ZCvUa/