バレンタイン 😈• 64,190
@VCarames
Posted
Hey there! 👋 Here is some feedback to further improve your code:
- The
form
should only be wrapping ⚠️ the rating "buttons" and "submit" button.
- This is
<input type="submit" class="btn" value="SUBMIT" id="submitBtn"/>
outdated. Instead use abutton
element.
- This is not necessary. Your JS should NOT ❌ be doing the job of CSS. You can use the pseudo element
:checked
to indicate which "button" was selected. So
const label = document.querySelectorAll(".rating")
label.forEach(i => {
i.addEventListener("click", function () {
label.forEach(i => i.classList.remove("active"))
this.classList.add("active")
})
})
If you have any questions or need further clarification, you can always check out my submission and/or feel free to reach out to me.
Happy Coding! 👾
Marked as helpful
1