In your click handler you are just adding on whatever is pressed. You need some logic in there to reject a decimal point if there is one in the current number.
I don’t know what is the logic?
Something like this:
if (already a decimal point in the input) {
don't allow user to enter a second decimal point
}
2 Likes
Yes, what jsdisco said. And that “don’t allow” logic can be somethings as simple as a return
statement (returning nothing) to keep the rest of the click handler from firing.
1 Like