流砂を使用して、製品リストのタイトル asc / desc および価格 asc / desc を再注文しています
何故かこんな感じで値段を並べている
10、1、2、3、4
または 4、3、2、1、10
値の最初の桁でソートしているように見えますか?
これが私のコードです...
if ( sortLi.hasClass( 'priceAsc' ) ) {
$lis.children().sortElements(function(a, b){
return $(a).find('input[name=price]').val() > $(b).find('input[name=price]').val() ? 1 : -1;
});
}
if ( sortLi.hasClass( 'priceDesc' ) ) {
$lis.children().sortElements(function(a, b){
return $(a).find('input[name=price]').val() < $(b).find('input[name=price]').val() ? 1 : -1;
});
}