Design comparison
SolutionDesign
Solution retrospective
This was definitely an interesting challenge for me as it includes the most DOM manipulation on any project I've worked on thus far.
Here's my thought process:
- I selected the various elements and added event listener to them
- I declared global variables with
let
and modified each variable inside the function that corresponds to the DOM element that holds the value for the variables. I used global variables so that they would be I would be able to used them to calculate for the total and tip. - For the input elements, I added keyup event to them so that the tip amount would change when there is a change in input. (That was the best I could think of; if there are better events I could have listened for, please feel free to let me know.)
- For each of the event listener, I called a function responsible for calculating the total that will be displayed in the DOM.
- I added
reset
event to theform
element and resets the inputs upon clicking of thereset
button.
I had fun building this project no doubt! I would really appreciate feedbacks on how to improve my work. Thanks in advance!😊✌️
Community feedback
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