Mukwende• 1,370
@mukwende2000
Posted
How to apply hover effect to only the clicked element
- Select all the ratings in your javascript using document.queryselectorAll(nameoftheelement)
- loop through each rating using a forEach and add an event listener for click to each rating
- Write a function that loops through all the ratings and check if the rating is the clicked element or not, if it is, add the class that has the hover effect else remove it.
Marked as helpful
1