Is it possible to sort and rearrange an array that looks like this:
itemsArray = [ [\'Anne\', \'a\'], [\'Bob\', \'b\'], [\'Henry\', \'b\'],
Use the $.inArray() method from jQuery. You then could do something like this
var sortingArr = [ 'b', 'c', 'b', 'b', 'c', 'd' ]; var newSortedArray = new Array(); for(var i=sortingArr.length; i--;) { var foundIn = $.inArray(sortingArr[i], itemsArray); newSortedArray.push(itemsArray[foundIn]); }