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