html5操作类名API——classlist

tagNode.classList.add('123'); // 添加类
tagNode.classList.remove('bbb'); // 删除类
tagNode.classList.toggle('eee'); // 切换类,如果有 eee 这个类则删除,没有则添加
tagNode.classList; // 返回DOMTokenList --- 类属性的实时集合


兼容性

posted @ 2019-01-17 21:11  图明  阅读(209)  评论(0编辑  收藏  举报
returnTop