Skip to content

Instantly share code, notes, and snippets.

@dannyvassallo
Created August 19, 2014 17:03
Show Gist options
  • Save dannyvassallo/b98b2652484744bdccef to your computer and use it in GitHub Desktop.
Save dannyvassallo/b98b2652484744bdccef to your computer and use it in GitHub Desktop.
var catItemS = ['.cat-item-45', '.cat-item-36'];
var catItemsLength = catItemS.length;
for (var i = 0; i < catItemsLength; i++){
orGanize(catItemS[i]);
}
function orGanize(){
var catItem = catItemS[i]
var elem = jQuery( catItem ).find('.children li').sort(sortMe);
jQuery( catItem +' .children').append(elem);
}
function sortMe(a, b) {
return a.className > b.className;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment