set in ascending order based on text
 $('button').click(function() {      var options = $('select.whatever option');      var arr = options.map(function(_, o) {          return {              t: $(o).text(),              v: o.value          };      }).get();      arr.sort(function(o1, o2) {          return o1.t > o2.t ? 1 : o1.t < o2.t ? -1 : 0;      });      options.each(function(i, o) {          console.log(i);          o.value = arr[i].v;          $(o).text(arr[i].t);      });  });