You need to replace this:
$('.genres').html('');
with
$('.genres').empty();
html uses the innerHTML property to remove content, and this is processed inconsistently among browsers, as you just saw. empty , however, uses the removeChild method and works sequentially in browsers. (By the way, jQuery 2.0 uses textContent .)
In addition, for your sort method to work sequentially, it needs to return a numeric value:
var sorted = $('.genres a').sort(function(a, b) { return a.innerHTML < b.innerHTML ? -1 : a.innerHTML === b.innerHTML ? 0 : 1; });
Fiddle
source share