Design comparison
Solution retrospective
Has a bug on the tip buttons that I cannot seem to figure out. Figured I would still upload and see if I can get some feedback as well as some help in fixing the problem.
Community feedback
- @IamparvesPosted almost 3 years ago
In the
calculateTip
function when you storetipPercentage
you are taking it formthis
. But the thing is when you add event listener to an element thenthis
keyword inside the callback function refers to that element. So whenever you click/change any fields, your tip percentage comes from that field. Doesn't matter if it's tip percentage field or not.You can store check using conditions which field you are dealing with and store the values in an object/variables. And then calculate using them.
Maybe you should look other peoples solution of this project. And also, it will be better if you use
form
.Good luck.
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