当前位置:首页 > Web开发 > 正文

html 操纵dom classLIst 属性

2024-03-31 Web开发

标签:

1.classList 属性

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

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

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

html 操纵dom classLIst 属性

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/31474.html