📜  js 添加类 - Javascript 代码示例

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

代码示例6
// This is to add a class to any html element after you store it
// in the element variable 

element.classList.add("my-class-name");

// This is to remove a class from the element

element.classlist.remove("my-class-name");