add-class
v1.0.3
Published
Add a given class to elements.
Downloads
107
Maintainers
Readme
add-class
Add a given class to elements.
Install
$ npm install --save add-class
Usage
var addClass = require('add-class');
var el = document.querySelector('div');
var els = document.querySelectorAll('span');
addClass(el, 'foo');
addClass(els, 'bar');
Browser API
addClass(element, className)
element
Required
Type: HTML DOM element
Element(s) to add class to.
className
Required
Type: string
Class name to be added.
Related
- has-class - Check if an element has a given class.
License
MIT © Andreas Gillström