i want to sort the drop down items using javascript,can anyone tell me how to do this.
DEPENDS ON JQUERY
function SortOptions(id) {
var prePrepend = "#";
if (id.match("^#") == "#") prePrepend = "";
$(prePrepend + id).html($(prePrepend + id + " option").sort(
function (a, b) { return a.text == b.text ? 0 : a.text < b.text ? -1 : 1 })
);
}
Examples:
SortOptions("#my-list-id");
OR
SortOptions("my-list-id");