1function alphabetizeList() {
2 var sel = $(listField);
3 var selected = sel.val(); // cache selected value, before reordering
4 var opts_list = sel.find('option');
5 opts_list.sort(function (a, b) {
6 return $(a).text() > $(b).text() ? 1 : -1;
7 });
8 sel.html('').append(opts_list);
9 sel.val(selected); // set cached selected value
10}
11
12alphabetizeList('#FIELDID');