Skip to content

Instantly share code, notes, and snippets.

@jookyboi
Created April 3, 2013 19:29
Show Gist options
  • Save jookyboi/5304487 to your computer and use it in GitHub Desktop.
Save jookyboi/5304487 to your computer and use it in GitHub Desktop.
var items = $('.alphaList li').get();
items.sort(function(a,b){
var keyA = $(a).text();
var keyB = $(b).text();
if (keyA < keyB) return -1;
if (keyA > keyB) return 1;
return 0;
});
var ul = $('.alphaList');
$.each(items, function(i, li){
ul.append(li);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment