本文共 281 字,大约阅读时间需要 1 分钟。
如果我们使用documen.getElementByClassName获取的数组,类型为html collection,需要转换成正常的dom对象数组
//删除所有的显示框,防止重复显示内容var show-box= document.getElementsByClassName('show-box');if (show-box.length > 0) { //将html collection转换为正常的数组 Array.from(show-box).forEach(function (box, index) { box.remove(); });}
转载地址:http://ovtbi.baihongyu.com/