@AhmedLebda
Posted
Hi @Davee89 Great Code !
You just need to add some validations for input fields , for example:
- users shouldn't be able to enter negative values (since you use a number type input this can be easily done with a
min="0"
attribute to the input element). - users shouldn't be able to enter anything but numbers in the input fields.
- just a plus point you can make result calculated whenever user changes any setting ( input values - or button clicks )
This is my Solution To this challenge, a review is really appreciated.
Happy Coding
Marked as helpful
@Davee89
Posted
@AhmedLebda
- users shouldn't be able to enter negative values (since you use a number type input this can be easily done with a min="0" attribute to the input element).
That's really helpfull! Already changed that!
- users shouldn't be able to enter anything but numbers in the input fields.
I think, that if I put type=numbers then you cant enter anything but numbers or dots correct?
- just a plus point you can make result calculated whenever user changes any setting ( input values - or button clicks )
That part I'm not sure how to make to be honest!
@AhmedLebda
Posted
@Davee89
- I think, that if I put type=numbers then you cant enter anything but numbers or dots correct?
right , you get automatic validation that the entered text is a number but user still can type text in the input field, it won't cause a problem I think but u can replace any input other than numbers with just "", so users can't enter any letters.
plus letting users able to type letters may cause some confusion in specific cases for example (1e3 will be equal to 100)
- That part I'm not sure how to make to be honest!
by adding event listeners on the inputs just like how u did the custom field in the tip amount section
Marked as helpful