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 app

faroole 80

@ahmed-Faroolle

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


Do you have any questions about best practices?

Community feedback

Ouattara 200

@Kaji17

Posted

Hi @ahmed-Faroolle good djob 👍, let me give you some tips that can help you👨‍💻.

  • You can use regex to format text in your field input instead type= 'number' to avoid to have a default vertical row in your input. Code:
<input type="text" ... oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*?)\..*/g, '$1');">

  • In your <div class="checkboxes__grid"> replace input and label to avoid to use label for write percentage 5% instead button . Code:

HTML

<div class="checkboxes__grid">
              <button class="check__box" id="fivepercent" value="5">5%</button>
              <button class="check__box" id="tenpercent" value="10">10%</button>
               ...
              <input type="text" placeholder="Custom" class="check__box custom" id="inputcustom"
              oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*?)\..*/g, '$1');">
</div>

JS

var selectTipTab = document.querySelectorAll('.check__box');

// add logic when we click on a button
selectTipTab.forEach(element => {
    element.addEventListener('click', () => {
      ...
    })
});

I hope it will be useful for you good code 🤞 (⌐■_■)

Marked as helpful

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