标签:lis rem document query asc get jquery 删除 pre
百度了好多资料,发现不管是jquery还是原生js的删除元素remove()或empty()方法,在mui上不管用。直到找到removeChild方法。
如下
var list=document.getElementById("myList"); list.removeChild(list.childNodes[0]);
修改为遍历删除元素下所有节点,如下
var list=document.getElementById("myList");
for(var i = list.childNodes.length; i > 0; i--) { list.removeChild(list.childNodes[i - 1]); }
标签:lis rem document query asc get jquery 删除 pre
原文地址:https://www.cnblogs.com/xiede/p/9114704.html