select multiple elements by class, and loop through them with javascript

I have a table with elements in it. I need to target them and change the css class.

<div class="dwtooltip"><img src="note_icon.png" /><span class="dwtooltiptext">my tooltip text here.</span></div>

const items = document.querySelectorAll(‘.dwtooltip’);
if(items){

}
for (var i=0; i < items.length; i++) {
console.log(i);
items.forEach(function(el){
el.classList.add(“notooltip”);
el.classList.remove(“dwtooltip”);
});
}


Leave a Reply