Created
May 18, 2013 13:51
-
-
Save stephanie-walter/5604464 to your computer and use it in GitHub Desktop.
Append class to an existing one in raw JS
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.body.className += ' hasJS' |
The right way to do that on recent browsers is:
document.body.classList.add('hasJS');
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome!