1

Hello i have a problem with a sort function. I've already looked at this : jQuery function doesn't work on Safari Using parsefloat does not resolved my problem. Can somebody help?

This script work perfectly in 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());
});
user367864
  • 283
  • 2
  • 5
  • 11

0 Answers0