I have a select box on a form, which carries an incremental rel attribute. I have a function that can sort the options by thier .text() value, into alphabetcal order.
I needed a similar solution then made some changes to the original function and it worked fine.
function NASort(a, b) { return (a.innerHTML.toLowerCase() > b.innerHTML.toLowerCase()) ? 1 : -1; }; $('select option').sort(NASort).appendTo('select');