.removeClass(...names)
Available on: InDom, InDomArrayRemoves one or more CSS classes from the underlying element(s).Parameters:
...names {string} - Class name(s) to remove (variadic)
Returns: {InDom | InDomArray} - this for chainingThrows: Error - If the underlying element(s) has been removed
Examples:// add 'clicked' class to any .example>div that gets clicked
const divs = $a('.example>div');
divs.onClick(n => n.addClass('clicked'));
// button: counts how many are currently clicked, then resets them
const sumResetClicked = $n('Sum and reset clicked');
$1('body').append(sumResetClicked);
sumResetClicked.onClick(() => {
let clicked = 0;
divs.each(n => {
if (n.hasClass('clicked')) { // test state
clicked++;
n.removeClass('clicked'); // reset state
}
});
console.log('clicked:' + clicked);
});Next: setStyle »