mui删除元素

百度了好多资料,发现不管是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]);
}

  

原文地址:https://www.cnblogs.com/xiede/p/9114704.html