PHP
·
发表于 5年以前
·
阅读量:8312
//Add Class
document.getElementById("MyElement").className += " MyClass";
//Remove Class
document.getElementById("MyElement").className = document.getElementById("MyElement").className.replace(/(?:^|\s)MyClass(?!\S)/,'');