我有一个动态创建的下面的列表:
<ul id="Bucket-1" class="list1" data-listidx="11">
<li><div style="cursor: pointer;">BYBO2</div></li>
<li style="display: none;"><div style="cursor: pointer; display: none;">FURG4</div></li>
<li><div style="cursor: pointer;">HCLB8</div></li>
<li style="display: none;"><div style="cursor: pointer; display: none;">KVQF1</div></li>
<li style="display: none;"><div style="cursor: pointer; display: none;">LYPI6</div></li>
<li><div style="cursor: pointer;">MLET3</div></li>
<li style="display: none;"><div style="cursor: pointer; display: none;">MPZM9</div></li>
<li style="display: none;"><div style="cursor: pointer; display: none;">RFHP7</div></li>
<li style="display: none;"><div style="cursor: pointer; display: none;">TEAR5</div></li>
</ul>
我必须通过jquery将排序应用到上面的<li>
,其中<li>
不包含style="display:none"
答案 0 :(得分:0)
您可以使用css类而不是display:none
,并使用THIS POST中的简单解决方案
的CSS:
.visible-li{}
.hidden-li{display:none;}
HTML:
<ul id="Bucket-1" class="list1" data-listidx="11">
<li class="visible-li"><div style="cursor: pointer;">BYBO2</div></li>
<li class="hidden-li"><div style="cursor: pointer;">FURG4</div></li>
<li class="visible-li"><div style="cursor: pointer;">ACLB8</div></li>
<li class="hidden-li"><div style="cursor: pointer;">KVQF1</div></li>
<li class="hidden-li"><div style="cursor: pointer;">LYPI6</div></li>
<li class="visible-li"><div style="cursor: pointer;">MLET3</div></li>
<li class="hidden-li"><div style="cursor: pointer;">MPZM9</div></li>
<li class="hidden-li"><div style="cursor: pointer;">RFHP7</div></li>
<li class="hidden-li"><div style="cursor: pointer;">TEAR5</div></li>
</ul>
最后在推荐的帖子中使用解决方案
上查看