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
SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
更多精彩