Created
February 21, 2014 11:44
-
-
Save maxivak/9132939 to your computer and use it in GitHub Desktop.
JS simple
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.getElementById("MyElement").className = " MyClass"; | |
// To add a class to an element: | |
document.getElementById("MyElement").className += " MyClass"; | |
// To remove a class from an element: | |
document.getElementById("MyElement").className = document.getElementById("MyElement").className.replace(/\bMyClass\b/','') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment