/dom-add-class

Add class using classList if present or using className when not

Primary LanguageJavaScriptMIT LicenseMIT

NPM Version Build Status

dom-add-class

Add classes to a given element or set of elements

Install

npm i --save dom-add-class

Usage

var addClass = require('dom-add-class');
var sektor = require('sektor');
var boxes = sektor('.box');

// add several classes
// to several elements
addClass(box, 'demo class added');

// won't add duplicated classes
addClass(box, 'repeated repeated classes'); // will only add 'repeated classes'

License

MIT