super basic html css and vanilla js

Solution retrospective
Tips appreciated! I totally could've used less JS code.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @elaineleung
Hi Jake, well done here, and yes, I do agree that you could use less code as well. But first off, just wanted to say I like the transition to the thank you card, which I haven't seen in any other solution. I've seen someone do a flip animation, but definitely a first for a slide up, and it's pretty cool I think!
About the JS, instead of querying each button individually, I would use
querySelectorAll
to grab all the buttons as group, and then in the line when the "review-active" style needs to be removed, I would just loop through the whole group instead of needing to write out each line individually. I also might just remove the "if" statement for checking whether a button has the "review-active" class, which really is only applicable for the first time the button is clicked.Anyway, if you'd like a comparison on how else the JS could be written, you can check out this CodePen I wrote as a mini component of this challenge: https://codepen.io/elaineleung/pen/RwMqMxZ
Once again, great work over all 😊
Marked as helpful
Join 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