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);
     }
    }

你可能感兴趣的:(js删除div节点)