📌  相关文章
📜  如何在javascript代码示例中向元素添加类

📅  最后修改于: 2022-03-11 15:03:03.958000             🧑  作者: 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");