Looking for a solution to sort elements by a number? Consider this part of a function that does just that. The number used for sorting is fetched from a data-ranking
attribute of the element:
$(".tab_entry").sort(function(a,b){
return parseFloat(a.dataset.ranking) < parseFloat(b.dataset.ranking)
}).appendTo('div.active');
The Issue: While this code works smoothly on Firefox 24, it runs into problems on Chrome 28 (sorting fails, wrong order), and doesn't perform as expected on Safari 5.1.7 and IE 10.
Anyone come across a fix for this?