Skip to content

Instantly share code, notes, and snippets.

Last active Sep 13, 2020
What would you like to do?
Add a class to an element
* Add a class to an element
* @param {Object|String} selector A reference to an element or a CSS selector string
* @param {String} className The class name
function addClass (selector, className) {
if (selector instanceof Element) {
} else if (typeof selector === "string") {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment