Sort Select Options by Value Attribute Using jQuery
$(function() {
// choose target dropdown
var select = $('select');
select.html(select.find('option').sort(function(x, y) {
// to change to descending order switch "<" for ">"
return $(x).text() > $(y).text() ? 1 : -1;
}));
// select default item after sorting (first item)
// $('select').get(0).selectedIndex = 0;
});
var selectList = $('#featuredSelectField option');
selectList.sort(function(a,b){
a = a.value;
b = b.value;
return a-b;
});
$('#featuredSelectField').html(selectList);
Here you cand find a demo and compare the results with the original: http://jsfiddle.net/74c2M/3/
Here you can find the proper code: http://jsfiddle.net/74c2M/4/
Good luck !