jquery排序功能在safari和chrome中不起作用

时间:2014-09-05 16:07:37

标签: jquery sorting

您好我的排序功能有问题。 我已经看过了这个:jQuery function doesn't work on Safari 使用parsefloat并没有解决我的问题。有人可以帮忙吗?

此脚本在Firefox中完美运行。

var totalProdblk,priceAsc,priceDesc;
totalProdblk = $('.prodblk');
priceAsc = $('#priceAsc');
priceDesc = $('#priceDesc');

// Price
priceAsc.click(function(){
    totalProdblk.sort(function(a, b){
        return a.getAttribute('data-price') > b.getAttribute('data-price')
    }).appendTo(totalProdblk.parent());
});

priceDesc.click(function(){
    totalProdblk.sort(function(a, b){
        return a.getAttribute('data-price') < b.getAttribute('data-price')
    }).appendTo(totalProdblk.parent());
});

0 个答案:

没有答案