I have the following code to sort the items in a dropdown list:
function sortDropDownListByText(selectId) {
$(selectId).html($(selectId + \" option\").so
If the "Please select..." option has a certain value (here called "dummyVal") associated with it, you could use this in your comparison function:
function sortDropDownListByText(selectId, dummyVal) {
$(selectId).html($(selectId + " option").sort(function(a, b) {
if (a.value == dummyVal) {
return -1;
}
return a.text == b.text ? 0 : a.text < b.text ? -1 : 1
}))
}