Skip to content

Instantly share code, notes, and snippets.

@Huskie
Created January 23, 2014 16:37
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 Huskie/8581908 to your computer and use it in GitHub Desktop.
Save Huskie/8581908 to your computer and use it in GitHub Desktop.
Plain JavaScript addClass function. Relies on plain JavaScript hasClass function defined in separate Gist
function addClass(element, className) {
if(!hasClass(element, className)) {
element.className += ' ' + className;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment