I have HTML like the following on my website:
<div class=groups>
<div class=group>
Group 1 priority:
<select>
<option value=1.0>1</option>
<option value=2.0 selected=selected>2</option>
<option value=3.0>3</option>
</select>
</div>
<div class=group>
Group 2 priority:
<select>
<option value=1.0>1</option>
<option value=2.0>2</option>
<option value=3.0 selected=selected>3</option>
</select>
</div>
<div class=group>
Group 3 priority:
<select>
<option value=1.0 selected=selected>1</option>
<option value=2.0>2</option>
<option value=3.0>3</option>
</select>
</div>
</div>
I am looking for a way to sort the order these groups appear in the browser using jQuery, based on the what is selected in the dropdown. It should resort when the user selects a new value in any of the dropdowns, or on page load.
What would be the easiest approach to this problem?
I have jQuery UI available, if the sortable thing can be used in any way. I couldn't not find a way to use that.
Update: There is other data in the <div class=group> that should follow the dropdowns wherever they are moved. The number of groups varies from 0 to 20.