Skip to content

Instantly share code, notes, and snippets.

@tored
Last active October 11, 2015 13:47
Show Gist options
  • Save tored/3867970 to your computer and use it in GitHub Desktop.
Save tored/3867970 to your computer and use it in GitHub Desktop.
addClass: adds CSS class to DOM element
function addClass(el, cls) {
if (!hasClass(el, cls)) {
el.className += (el.className ? ' ': '') + cls;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment