JohnnyBGoode
Programmer
I currently have a select list:
I add and remove items dynamically using the folowing:
However, when I add and remove, it does so at the end of the list (eg. remove "A", then re-add "A", it is added at the bottom). How can I easily re-sort this list (alpha)? Is there a javascript function for this?
Thank you.
Code:
<select name="list">
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
</select>
I add and remove items dynamically using the folowing:
Code:
list.options.add(oOptionItem);
list.options.remove(i);
However, when I add and remove, it does so at the end of the list (eg. remove "A", then re-add "A", it is added at the bottom). How can I easily re-sort this list (alpha)? Is there a javascript function for this?
Thank you.