Add and Remove Classes Using JavaScript
You can dynamically remove and add classes for HTML tags quite easily with JavaScript.
const div = document.createElement('div');
div.className = 'foo';
// use the classList API to remove and add classes
div.classList.remove("foo");
div.classList.add("bar", "#baz");
div.classList.remove("bar", "baz");