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

  

相关文章:

  • 2021-08-09
  • 2021-06-29
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-14
  • 2022-01-17
  • 2021-12-04
  • 2021-12-26
  • 2021-12-26
  • 2021-05-21
相关资源
相似解决方案