Skip to content

Instantly share code, notes, and snippets.

@jjmu15
Created January 31, 2014 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjmu15/8729023 to your computer and use it in GitHub Desktop.
Save jjmu15/8729023 to your computer and use it in GitHub Desktop.
remove class - vanilla js
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