📜  js css 类 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:35.130000             🧑  作者: Mango

代码示例1
// To add a class to an element:
const element = document.getElementById("myDIV");
element.classList.add("myClass");
// To get all classes of an element:
const element = document.getElementById("myDIV");
let classList = element.classList;