jQuery按最高编号而不是按字母顺序排序列表

时间:2019-12-11 09:49:57

标签: jquery html css

我正在建立一个网站,我需要根据其最高价值对一些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);
        });

有什么方法可以更改代码,以便根据数字排序?

0 个答案:

没有答案