帮助,这是我的代码:
<script>
$(document).ready(function() {
// Get your list items
var items = $('ul.categories > li');
// The new index order for each item, first item is always numbered "0"
var order = [4,2,3,0,1];
// Map the existing items to their new positions
var orderedItems = $.map(order, function(value) {
return items.get(value);
});
// Clear the old list items and insert the newly ordered ones
$('ul.categories').empty().html(orderedItems);
});
</script>
这种重新排序适用于除IE之外的所有浏览器(显示列表两次,所以我怀疑.empty()
由于某种原因无效?
非常感谢提前。
答案 0 :(得分:0)
你不需要清空它
T
$('ul.categories').html(orderedItems);