Jan 02
Sorted elements
Include jQuery !!
地図上で目的地を選択
<p class="tv-check-item"> <input id="added_utype_6" class="checkIterator" type="checkbox" name="added_utype_6" value="Plubs" checked="true"/> <label for="added_utype_6"> Plubs</label> </p> <p class="tv-check-item"> <input id="added_utype_1" class="checkIterator" type="checkbox" name="added_utype_1" value="Allotum" checked="true"/> <label for="added_utype_1"> Allotum</label> </p> <p class="tv-check-item"> <input id="added_utype_0" class="checkIterator" type="checkbox" name="added_utype_0" value="Anotum" checked="true"/> <label for="added_utype_0"> Anotum</label> </p>
for (t = 0; t < $("p[@class='tv-check-item']").length; t++) { compareElement = $("p[@class='tv-check-item']").get(t); compareValue = $(compareElement).children("input").get(0); compareValue = $(compareValue).val(); $("p[@class='tv-check-item']:gt("+t+")").each(function(i){ toBeCompared = $(this).children("input").get(0); toBeCompared = $(toBeCompared).val(); if (toBeCompared.toLowerCase() < compareValue.toLowerCase()) { $(compareElement).before(this); compareElement = this; compareValue = $(compareElement).children("input").get(0); compareValue = $(compareValue).val(); } }); }
