Interactive-rating-main By JonathanBees Js, Css, Html
Design comparison
Solution retrospective
Issues during the creation of this challenge
Distribution of buttons
-
Create each button (the 5 circles of the rate) was so difficult especcially because i was changing sometimes the HTML elements, for example, at the beggining i create these with only div division, then, searching, i found that is easier to create input and label elements to just hide the input elements and work with the label elements, but at least i learn a little more about html forms :)
-
i didn´t find the way to put the 5 circles and the button at the same time thinking about how can i do to validate that the input element needs to be selected before pressing the button to show the next section, i appreciate if anyone can advice me about it, this will help me a lot
Javascript functionalities
-
First of all, during the creation of the click function to change the color of the selected circle i was a little confused of how can i pick all of the 5 items without having a id or a class according to each of these (in the code i let some of my attempts to recreate that function seeing that all of that was true :3)
-
then, i don´t understand so much of how can i collect the information of the button (the number) that was pressed, after a few attemps, i found that the method: stringify() can help me with that and then, just transform my string into a char with just a chartAt method
-
Finally, i understand that i can just add or remove classes (like the click function) to hide or show the part that is interesting to me, in this case, the thanks section once i press the submit button, i also learn a little of how to create HTML elements with javascript to push them in the section that i needed
Learnings during the developing of this challenge
-
I learn a lot more about some CSS elements, i hope that one day i will do it more mechanically :), it´s obvious that i need to learn a lot more, and maybe in this challenge the code it´s not the better optimized, but it´s an attemp, i need to learn more about specially in the responsive design, because i don´t understand a lot of how to do that, i will be very gratefull if someone can give me some advices according to this
-
I learn a little more about javascript DOM manipulation, it´s a long way to understand all the javascript that i want to learn, but one step a time, if you read this, if you can give me advices of my distribution of my javascript code to improve it, or explain me of how could i resolve the issues that i had, i´ll be very grateful :3
Community feedback
- @alirs07Posted 10 months ago
Hi. User can select multiple options, you can fix that by simply adding the name attribute with the same values to the inputs.
To validate if any input is selected I did this: I declared a variable with the value of 0, then with a forEach method check if any input is selected then change the variable value to input value.
Hope that helps you!
Marked as helpful2
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