CSS Classes API
cls.add()
Adds the passed CSS classes to the matched DOM elements, omitting any classes that are already present.
- Accepts arguments as strings and arrays of strings.
You can pass CSS classes as individual arguments, as an array, or as a string separated by commas or spaces.
Each value is seen as a new argument.
Example:
$('div ?').cls.add('book');
// Adds the CSS class 'book' to all <div> elements.
$('div ?').cls.add('book', 'cat');
// Adds the CSS classes 'book' and 'cat' to all <div> elements.
$('body').cls.add('book', 'cat');
$('body').cls.add(['book', 'cat']);
$('body').cls.add('book, cat');
$('body').cls.add('book cat');
// Adds the CSS classes 'book' and 'cat' to the <body> element.