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

Mobile first solution: Sass, moment.js

Fidelisuzoma•380
@UzomaFidelis
A solution to the Age calculator app challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


In my time using HTML number input I've found that it's sometimes not so easy to prevent a user from entering some unwanted characters like the e, +, - and dot(.). Tried different approaches. Some of those didn't work too well. I settled on using a regex expression to replace those characters in the value. Please let me know if you've used a different method that works.

And why does the number input return an empty string for input.value when (+), (-) are the inputs. And I believe it returns only '2' when one inputs '2.'. Cos this gave me some headache when I was trying to read the value on each input and slice off the end when the character is one of the unwanted ones.

Thanks in advance

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Fidelisuzoma's solution.

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

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

Frontend Mentor

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

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