Skip to content

Instantly share code, notes, and snippets.

@tored
Last active October 11, 2015 13:47
Show Gist options
  • Save tored/3867975 to your computer and use it in GitHub Desktop.
Save tored/3867975 to your computer and use it in GitHub Desktop.
removeClass: removes CSS class from DOM element
function removeClass(el, cls) {
var reg;
if (hasClass(el, cls)) {
reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
el.className = el.className.replace(reg,' ').replace(/^\s+|\s+$/g, '');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment