我的Javascript(用于在ul中重新排序li)在IE中不起作用
My Javascript (used to re-order li's in a ul) doesnt work in IE
帮助,这是我的代码:
<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(IE 显示列表两次,所以我怀疑.empty()
由于某种原因不起作用?
提前非常感谢。
你不需要清空它
尝试
$('ul.categories').html(orderedItems);
相关文章:
- 为什么我的JavaScript堆栈排序函数不起作用
- Rubaxa可与聚合物进行排序/拖放不起作用,具体取决于显示器:
- 我在页面中使用的jQuery UI可排序项目;不起作用
- jquery中DataTables插件中的排序不起作用
- jQuery dataTables基于类型的列筛选不起作用?Img alt过滤器/排序
- 为什么这个排序函数不起作用
- 为什么这个排序功能在 Safari 中不起作用
- JavaScript排序算法不起作用 - 任何明显的我做错了
- j查询排序不起作用
- 网页按价格排序下拉菜单不起作用
- 表排序器寻呼机在调查视图上不起作用
- 为什么这种 jquery 驱动的表排序不起作用
- jQuery DataTables排序不起作用
- D3中的排序条形图不起作用
- populate中的Mongoose排序不起作用
- 表排序在IE 7中不起作用
- 使用J-query数据表,美国日期格式的自定义排序不起作用
- jQuery 表排序器排序不起作用
- 我的Javascript(用于在ul中重新排序li)在IE中不起作用
- 从 AJAX 调用的 PHP 对数组进行排序不起作用