Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Tip calculator using javascript

Marit 400

@Maritxx

Desktop design screenshot for the Tip calculator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hi! this is my solution for the tip calculator project. I struggled with the custom button (updating the value for that) and the updating of values when the input changes. Is there a smart way of doing this?

Community feedback

Eray 1,410

@ErayBarslan

Posted

Hey, great work on the challenge! You can use input eventListener to achieve that. For custom input it would be:

document.getElementById("custom__button").addEventListener('input', (e) => {
	calculateTipAmount(e, e.target.value / 100)
})

You can apply the same to other inputs. Happy coding :)

0

Please log in to post a comment

Log in with GitHub
Discord logo

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