【发布时间】:2014-07-14 04:51:19
【问题描述】:
我有以下代码。 如何使用 jQuery 按 DESC 顺序对它们进行排序?或者是否可以使用 CSS 进行排序?但我更喜欢 jQuery...
<div class="bf-attr-block-cont">
<div class="bf-attr-filter bf-attr-2 bf-row">
<span class="bf-cell bf-c-1">
<input type="checkbox" value="2pm.com" name="attribute_value[2][]" id="bf-attr-2-0">
</span>
<span class="bf-cell bf-c-2">
<label class="bf-attr-val" for="bf-attr-2-0">2pm.com</label>
</span>
<span class="bf-cell bf-c-3"><span class="bf-count">4</span></span>
</div>
<div class="bf-attr-filter bf-attr-2 bf-row">
<span class="bf-cell bf-c-1">
<input type="checkbox" value="Adidas" name="attribute_value[2][]" id="bf-attr-2-1">
</span>
<span class="bf-cell bf-c-2">
<label class="bf-attr-val" for="bf-attr-2-1">Adidas</label>
</span>
<span class="bf-cell bf-c-3"><span class="bf-count">2</span></span>
</div>
<div class="bf-attr-filter bf-attr-2 bf-row">
<span class="bf-cell bf-c-1">
<input type="checkbox" value="AJ Morgan" name="attribute_value[2][]" id="bf-attr-2-2">
</span>
<span class="bf-cell bf-c-2">
<label class="bf-attr-val" for="bf-attr-2-2">AJ Morgan</label>
</span>
<span class="bf-cell bf-c-3"><span class="bf-count">2</span></span>
</div>
【问题讨论】:
-
检查这个:link
-
按什么排序?
-
根据 bf-count 排序
-
@MajidAkbari,我需要按数字排序,而不是按字母排序
-
使用
parseInt(val, 10)进行数字排序。就是这样。
标签: jquery