Removing elements by class name?

后端 未结 16 1716
猫巷女王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条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 12:46

    You can you use a simple solution, just change the class, the HTML Collection filter is updated:

    var cur_columns = document.getElementsByClassName('column');
    
    for (i in cur_columns) {
       cur_columns[i].className = '';
    }
    

    Ref: http://www.w3.org/TR/2011/WD-html5-author-20110705/common-dom-interfaces.html

提交回复
热议问题