I'm trying to get all the elements of a class (.rating_note), and remove the class "selected" from all of them. What I have tried is:
const item = document.querySelectorAll('.rating_note');
item.classList.remove('selected');
And I get the following error:
"Uncaught TypeError: item.classList is undefined"
It seems that the querySelector is giving me html, not objects (?) when giving console.log on 'item'.
So, what is the standard approach for this?
Thank you.
..and a piece of the html
<button class="circle rating_note" id="btn1" onclick="rate(1)">1</button>
<button class="circle rating_note selected" id="btn2" onclick="rate(2)">2</button>