If I have a dropdown and a listbox, is there a way to order the listbox based on the dropdown using JQuery? An example would be helpful.
+1
A:
This alters the order in the pulldown. You'll have to set the order depending on your own criteria:
<select id="the-select">
<option value="1">First option</option>
<option value="2">Second option</option>
</select>
<script type="text/javascript">
//<![CDATA[
$(function (){
$("#the-select option[value=2]").insertBefore("#the-select option[value=1]");
});
//]]>
</script>
Seb
2009-03-19 00:12:30