CSS Classes API
cls.replace()
Replaces one CSS class with another on matched DOM elements.
- Accepts either two string arguments or a single object.
Example:
$('body').cls.replace('book', 'cat');
// Replaces the CSS class 'book' with 'cat' on the <body> element.
$('body').cls.replace({'book': 'abc', 'cat': 'def'});
// Replaces the CSS class 'book' with 'abc' and 'cat' with 'def' on the <body> element.
$('div ?').cls.replace('book', 'cat');
// Replaces the CSS class 'book' with 'cat' on all <div> elements.
$('div ?').cls.replace({'book': 'abc', 'cat': 'def'});
// Replaces the CSS class 'book' with 'abc' and 'cat' with 'def' on all <div> elements.