Design comparison
Solution retrospective
The fact that I could write JS more easily than before shows a lot of improvement that I have made. I used for loop template literal classlist keyword
What challenges did you encounter, and how did you overcome them?I wanted to add a close button that will return the content of my main section to its initial stage but I could not do it and I had no choice but to let it go
What specific areas of your project would you like help with?Any advice on how to do a close button that removes the thank you page and renders the rating page.
Community feedback
- @R3ygoskiPosted 7 months ago
Hello Samuel, congratulations on completing your project, it is very well done.
Based on the question you asked in Koda's comment, I chose to download and change some parts of his project, in order to show how you could do what he said. And I also made a system to remove the thank you card automatically, but you can change it and add a button.
I will soon open an Issues on your Github to show how the project turned out.
Marked as helpful1 - @kodan96Posted 7 months ago
hi there! 👋
Instead of overwriting the entire
<main>
element's content it might be a better idea to build the card component in your HTML, style it with CSS and use JS to toggle the two separated parts (so the rating component and the card separately)You can achieve it easily with jQuery or with plain JS using
style.display
in your event handler.Hope this helps 🙏
Good luck and happy coding!
1@Sylvester009Posted 7 months ago@kodan96, I thought of your suggestion also but that will nullify the use of tenary operator to display the number clicked when the submit button is clicked
1@BibiUSAPosted 6 months ago@Sylvester009 hey, I also saw your code and from what I learned, best practice is to keep as much as HTML on the HTML document instead of having that spill over to the JS file.
You can take a look at how I was able to toggle it in my code here:https://www.frontendmentor.io/solutions/interactive-rating-component-9uuhA32fYl
I got the innerHTML of the button clicked, turned that into an integer, and set that as the value for variable "answer". So if answer had a value that's not 0, it must mean one of the button was clicked.
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