Answers for "jquery order by specific order"

0

jquery order by specific order

var arr = arr.sort(function(a,b) {
    return order.indexOf( a.key ) - order.indexOf( b.key );    
});
Posted by: Guest on February-12-2021
0

jquery order by specific order

var arr = arr.sort(function(a,b) {
    return order.indexOf( a.key ) - order.indexOf( b.key );
    //for the sake of recent versions of Google Chrome use:
    //return a.key.charCodeAt(0) > b.key.charCodeAt(0); or return a.key.charCodeAt(0) - b.key.charCodeAt(0);
});
Posted by: Guest on February-12-2021

Code answers related to "jquery order by specific order"

Code answers related to "Javascript"

Browse Popular Code Answers by Language