my work of responsive interactive rating component- HTML-CSS-JS was us
Design comparison
Solution retrospective
Hello everyone, I couldn't do the javascript part, I tried to apply the capturing method, but I couldn't get the result I wanted. Thanks for your feedback...
Community feedback
- @elaineleungPosted over 2 years ago
Hi KerimGurbaz, I just had a quick look at your code; I think you can try setting using a
let
variable to record the score given, and then use that variable for the display message later. Also, you don't have to use a separate function for each of your buttons as this becomes redundant; you can just use iteration for this.I have two CodePen examples that you can check out:
This one uses a disabled button that only activates when a number is selected: https://codepen.io/elaineleung/pen/GRxBNpE
This one uses an alert box if no number is selected: https://codepen.io/elaineleung/pen/xxWzZPv
Good luck writing the Javascript, and hope this helps!
Marked as helpful2@KerimGurbazPosted over 2 years ago@elaineleung Thank you very much, you explained very well, your examples read, but unfortunately I couldn't apply it to my own codes. I keep trying. I wish you the best of luck.
0@elaineleungPosted over 2 years ago@KerimGurbaz No worries! What are you trying to do exactly, and what is the result you want to see?
Marked as helpful0@KerimGurbazPosted over 2 years agoHello @elaineleung, thanks for your help. I actually did a lot in general. but at the same time, the background color of more than one button becomes gray. For example, if button 1 is clicked, only button 1 should be gray. Whichever button I clicked last will be gray. I want the others to return to their previous color. your example is very successful =)
0
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