html 操作dom classLIst 属性

1.classList 属性

可以给指定的dom 增加多个class,他是只读的,只可以使用 add() 和 remove() 方法修改。

        eg:  document.getElementById("myDIV").classList.add("mystyle", "anotherClass", "thirdClass");

具体见菜鸟教程:https://www.runoob.com/jsref/prop-element-classlist.html

posted @ 2020-01-17 17:38  Empress&  阅读(185)  评论(0编辑  收藏  举报