Here is the main idea ...
var sortedSet = $('#sort li').toArray().sort(function(a, b) { return $(a).data('rating') - $(b).data('rating'); });
You select the elements, convert them to the correct array, and then sort them (using the comparison function that I used, changing it according to your requirements).
jsFiddle with the lowest button .
alex
source share