Created
January 31, 2014 09:33
-
-
Save jjmu15/8729023 to your computer and use it in GitHub Desktop.
remove class - vanilla js
This file contains hidden or 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
if (el.classList) | |
el.classList.remove(className) | |
else | |
el.className = el.className.replace(new RegExp('(^| )' + className.split(' ').join('|') + '( |$)', 'gi'), ' ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment