@VCarames
Posted
Hey there! π Here are some suggestions to help improve your code:
Regarding your questions,
In order to answer them, you first need to fix π οΈ your HTML;
- To ensure that the "rating buttons" are fully accessible π―, they need to be built using a
form
β οΈ (with alegend
) and inside of it, there should be fiveinput radios
and eachinput
should have alabel
attached to it to make the buttons accessible. Finally wrap all theinputs
andlabels
inside afieldset
to prevent users from making more than one selection.
More Info: π
- As for your JS, the
eventListener
should be on theform
β οΈ as asubmit
.
- To get the βratingβ β οΈ you would use
const rating = form. querySelector (" input [type= 'radio']: checked")
- All the JS should do is display the βthank you" content and hide the previous content by removing/adding the
hidden
attribute/class.
If you have any questions or need further clarification, feel free to reach out to me.
Happy Coding! πππͺ