Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 2 years ago

Responsive Tip calculator app made with pure HTML, CSS and vanilla js

Tiago•40
@brtiago
A solution to the Tip calculator app challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hey, guys! This is my first project submission. It took me a while since I'm new to programming in HTML, CSS, and JavaScript.

What did you find difficult while building the project? I found some difficulties in DOM manipulating and maybe optimizing my code. It was a nice challenge for me to learn new things.

Any feedback is greatly appreciated! Thanks!😊

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Gesiere•780
    @Gesiere
    Posted about 2 years ago

    Hi Tiago, nice one. You did well but like the comment above I faced the same issues.

    1. When I add 0 on the number of people text field, and the error appears. I expect that the error disappears if I correct it, by adding a number greater than 0. But the error still persist. That needs to be corrected.

    2. To change your input border on focus, you need to select that particular input element and add the focus pseudo element eg Input: focus{ border: 2px solid #whatever color you want } For your first you did well but I suggest trying newbie projects first before coming to Junior. Happy coding.

    Marked as helpful
  • Michael•240
    @mksoofian
    Posted about 2 years ago

    Hi Tiago,

     I really appreciate your submission because your code helped me overcome the challenges I left unsolved with my code. I also only used vanilla JS and CSS!
    
    1. I could not get the border color to change on focus because by default, the browser was highlighting the input a different color. My solution from your code was setting "outline:none".

    2. I wasn't able to get my results to calculate as I input numbers in the text field. It would only update after clicking away from the input. My solution based on your code was to run my updateAll() function in every input event listener.

      This actually revealed to me bugs in your code. Your app will only work if the bill, tip and number of people are provided in the vertical order of the layout. However, app crashed if number of people is entered first, it also will not let me change the tip% after my initial input/button selection. I would suggest to update the code to update results after every input as I learned in my second point above as we can probably expect users to manipulate and edit fields for any number of reasons.

    I hope this feedback helps!

    -Mike -Mike

    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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub