Removing elements by class name?

后端 未结 16 1702
猫巷女王i
猫巷女王i 2020-11-27 12:06

I have the below code to find elements with their class name:

// Get the element by their class name
var cur_columns = document.getElementsByClassName(\'colu         


        
16条回答
  •  -上瘾入骨i
    2020-11-27 12:42

    Using jQuery (which you really could be using in this case, I think), you could do this like so:

    $('.column').remove();
    

    Otherwise, you're going to need to use the parent of each element to remove it:

    element.parentNode.removeChild(element);
    

提交回复
热议问题