I would like to know how to select all elements with class names \"widget\" and \"hover\" and then remove class \"hover\" from these elements.
I have the following J
Times have changed and now the cleanest and most readable way to do this is:
Array.from(document.getElementsByClassName('widget hover')).forEach((el) => el.classList.remove('hover'));
If you can't support arrow functions then just convert it like this:
Array.from(document.getElementsByClassName('widget hover')).forEach(function(el) {
el.classList.remove('hover');
});
Additionally if you need to support extremely old browsers then use a polyfil for the forEach and Array.from and move on with your life.