我正在建立一个网站,我需要根据其最高价值对一些DIV进行排序。到目前为止,我只能按字母顺序对它们进行排序。这是我的代码:
$(".classOfUL").each(function() {
$(this).find('.classOfLI').sort(function(a, b) {
var aText = $(a).text(),
bText = $(b).text();
return aText < bText ? -1 : aText > bText ? 1 : 0;
}).appendTo(this);
});
有什么方法可以更改代码,以便根据数字排序?