(Pure javascript only, please!)
I want to create a helper function that removes a single class from a div with several classes. I'm imagining a function as follows:
function remove_class(div, klass) {
div.className = div.className.replace( /(?:^|\s)active(?!\S)/ , '' );
}
The class removed here is active. However, how can I remove any class name, ie. one passed as the klass variable?
classList? The MDN page even has a shim for browser compatibility