You need to modify your dec_sort
function, just switch the order of the a
and b
argument variables.
function dec_sort(a, b){ //instead of b, a
return ($(b).text()) > ($(a).text()) ? 1 : -1;
}
Also, store the contents of your .list
tag:
var original = $('.list').html();
So when you want to restore the list, you can do:
$('.list').html(original);