remove by class name javascript code example
Example 1: es6 add and remove class
let el = document.getElementById('container');
//remove class
el.classList.remove('first');
//remove class
el.classList.add('first');
Example 2: js remove class
const removeClass = (element, name) => {
const pattern = new RegExp('(?:^|\\s)'+ name + '(?:\\s|$)', 'g');
element.className = element.className.replace(pattern, "");
};