I am a beginner in JavaScript and I'm hoping for some assistance. I have an HTML list with a select option, and I want to sort the list based on the selected character.
Specifically, I would like to arrange the "Z" options first, followed by the "B" options. The selected option's name can change dynamically. Is there a way to achieve this sorting after the character Z?
<ul id="pi" class="list" data-enhance="false">
<li class="ui-state-default ui-sortable-handle">
<div class="tt_wrapper tooltipstered">
<select
data-mini="false"
data-native-menu="true"
name="p_01"
id=""
class=""
disabled=""
>
<option value=""></option>
<option value="Z">Z</option>
<option value="B" selected="selected">B</option>
</select>
</div>
</li>
<li class="ui-state-default ui-sortable-handle">
<div class="tt_wrapper tooltipstered">
<select
data-mini="false"
data-native-menu="true"
name="p_02"
id=""
class=""
disabled=""
>
<option value=""></option>
<option value="Z" selected="selected">Z</option>
<option value="B">B</option>
</select>
</div>
</li>
</ul>