how to clear class in vanilla js code example
Example 1: how to remove an class in javascript
document.getElementsByClassName("legend").style.display="none";
Example 2: js remove class
const removeClass = (element, name) => {
const pattern = new RegExp('(?:^|\\s)'+ name + '(?:\\s|$)', 'g');
element.className = element.className.replace(pattern, "");
};