1/97

Add or remove class from an element

Add a class to an element

Note that multiple parameters for the add() isn't supported in IE 11.

ele.classList.add('class-name');

// Add multiple classes (Not supported in IE 11)
ele.classList.add('another', 'class', 'name');

Remove a class from an element

Note that multiple parameters for the remove() isn't supported in IE 11.

ele.classList.remove('class-name');

// Remove multiple classes (Not supported in IE 11)
ele.classList.remove('another', 'class', 'name');

Toggle a class

ele.classList.toggle('class-name');

Might be useful