Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CSS class functions
function addClass(cls) {
this[0].classList.add(cls);
}
function removeClass(cls) {
this[0].classList.remove(cls);
}
function hasClass(cls) {
return this[0].classList.contains(cls);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment