I fund a very nice sorting function here How may I sort a list alphabetically using jQuery? works almost perfect except that it looks like sorts by first charachter only , for example if you have something like
0-5000
5001-10000
10001-15000
15001-20000
the order will look like
0-5000
10001-15000
15001-20000
5001-10000
instead
0-5000
5001-10000
10001-15000
15001-20000
I redid the function for every select in the form
var mylist = $('#myformid select');
$(mylist).each(function (sorter, elm) {
var listitems = $(this).children('option.myoptionclass').get();
listitems.sort(function(a, b) {
var compA = $(a).text().toUpperCase();
var compB = $(b).text().toUpperCase();
return (compA < compB) ? -1 : (compA > compB) ? 1 : 0;
})
$.each(listitems, function(idx, itm) {
$(this).parent().append(itm);
});
});
here is live example
any help is welcome!