js给元素添加或者删除class

在html5中增加了classList

document.getElementById("button").classList.add(“active”);

document.getElementById("button").classList.remove("active");

posted @ 2019-08-29 10:22  码弄  阅读(7736)  评论(0)    收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示