Skip to content

Instantly share code, notes, and snippets.

@lleitep3
Created September 1, 2015 11:15
Show Gist options
  • Save lleitep3/cef67b3e88fede0d2e6a to your computer and use it in GitHub Desktop.
Save lleitep3/cef67b3e88fede0d2e6a to your computer and use it in GitHub Desktop.
Element.prototype.addClass = function (className) {
if (this.className.indexOf(className) === -1)
this.className = this.className + ' '+className;
};
Element.prototype.hasClass = function (className) {
return (this.className.indexOf(className) > -1);
}
Element.prototype.removeClass = function (className) {
this.className = this.className.replace(className, '');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment