I am trying this solution to sort out a drop down menu but having two digits in the options, 14 and 11 comes before 8 and 9.
How should I approach this?
My code is as follows:
<select id="test">
<option>Size 9</option>
<option>Size 14</option>
<option>Size 8</option>
<option>Size 11</option>
</select>
$("#test").html($("#test option").sort(function (a, b) {
return a.text == b.text ? 0 : a.text < b.text ? -1 : 1;
}))
I will need a solution to sort the drop down even if there are only characters, not mixed.