Submitted about 2 years ago
Interactive rating component using vanilla CSS
@loifloro
Design comparison
SolutionDesign
Solution retrospective
I have a question in my mind, is it impossible to use the document.getElementByClassNames for getting class names, because the one I used is document.querySelector to get the class names?
Community feedback
- @qudus2019Posted about 2 years ago
Yes sure, to grab more than one elements with a class name, it's possible to use getElementsByClassName instead of querySelectorAll.
The former returns a HTML collection and you can't use Array methods on it like forEach(), Map() etc. Unless you convert the collection to an Array first.
The latter returns a Node list that can accept the above mentioned methods.
Thank you
Marked as helpful1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord