Re:How to manage HTML DOM with vanilla JavaScript only?
by abdusco on Thursday April 02, 2020 @12:46PM
(#22760909)
You can also give it a second boolean argument to force add/remove classes.
let flag = false;
ele.classList.toggle('has--flag', flag);
will remove the class, for example.https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenLis...
That seems really useful, and I had no idea it existed.