私はこのHTMLを持っています
<td colspan="4" class="item"> DERBY LINE, VT 05830<br>
<label for="" data-sort="16.26">UPS Ground $16.26</label><br>
<label for="" data-sort="27.57">UPS 3 Day Select® $27.57</label><br>
<label for="" data-sort="33.87">UPS 2nd Day Air® $33.87</label><br>
<label for="" data-sort="72.82">UPS Next Day Air $72.82</label><br>
<label for="" data-sort="7.99">USPS Priority $7.99</label><br>
<label for="" data-sort="9.61">FEDEX SmartPost® FedEx Delivered Via USPS $9.61</label><br>
<input type="button" name="Button5" id="Button5" onmouseout="this.className='btn'" onmouseover="this.className='btn_over'" onclick="document.shipquote.action='shipquote.asp?action=clean';document.shipquote.submit();" value="Clear" class="btn">
</td>
そして、「データソート」属性でソートする必要があります。現在、 この要素ソーターを使用し ていますが、スクリプトを実行すると、これが返されます
<td colspan="4" class="item"> DERBY LINE, VT 05830<br>
<label for="" data-sort="16.26">UPS Ground $16.26</label><br>
<label for="" data-sort="27.57">UPS 3 Day Select® $27.57</label><br>
<label for="" data-sort="33.87">UPS 2nd Day Air® $33.87</label><br>
<label for="" data-sort="7.99">USPS Priority $7.99</label><br>
<label for="" data-sort="72.82">UPS Next Day Air $72.82</label><br>
<label for="" data-sort="9.61">FEDEX SmartPost® FedEx Delivered Via USPS $9.61</label><br>
<input type="button" name="Button5" id="Button5" onmouseout="this.className='btn'" onmouseover="this.className='btn_over'" onclick="document.shipquote.action='shipquote.asp?action=clean';document.shipquote.submit();" value="Clear" class="btn">
</td>
ご覧のとおり実行されますが、何らかの理由で属性の最初の番号だけが取得されます。私が使用している呼び出しは次のとおりです。
$('.item label').sortElements(function(a, b){
return $(a).attr("data-sort") > $(b).attr("data-sort") ? 1 : -1;
});
私は何を間違っていますか?