Design comparison
Solution retrospective
Is there any notes about the styling? the JS part? Any helpful notes are welcome ^^.
Community feedback
- @molszewski34Posted about 3 years ago
In my aproach i used it for form. If you use input instead of submit it use functions anytime you pass the numbers so this way you get a real time calculation like in normal calculator.
If you are worried about alert msg you can try to give your input in html vallue=1 or give min=1 so this way it should never show alert msg at the start but keep in mind this is reserve for input type number. I used input type number.
I checked alerts again and now it works.
Marked as helpful0 - @molszewski34Posted about 3 years ago
Hey. There are few issues. First is that you not included method .toFixed(2) so output gives big numbers after dot. Second is less important but still worth mention. The way you need to confirm input by "submit" can confuse user that output is not showing. I propose to change it for "input". Third is that your "alert" function not working when user provide 0.
Checked on Firefox browser.
Marked as helpful0@Menna-RashadPosted about 3 years ago@molszewski34 Thanks a ton! Can I ask why should I replace the "submit" with "input"? The input of the whole form? or a certain input field? shouldn't that cause the alert message to be displayed all the time? (until the user changes its value to be more than 0?) I also checked it on both Firefox & Chrome and the alert function works (when the user provides a 0 or no input at all)
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