js删除div节点

var f = document.getElementsByClassName("tags-wrapper"); var childs = f; for(var i = 0; i < childs.length; i++) { console.log(childs[i]) if(i==0){ var removeObj = document.getElementsByClassName('tags-wrapper')[i]; removeObj.remove(removeObj); } if(i==1){ var removeObj = document.getElementsByClassName('tags-wrapper')[i]; removeObj.remove(removeObj); } }

本文章由javascript技术分享原创和收集

发表评论 (审核通过后显示评论):