Answer the question
In order to leave comments, you need to log in
How to catch pressing the "comma" and "dot" buttons with javascript in a mobile browser?
Hello! There is a task to validate the input so that only numbers can be entered into it.
Partially solved the problem by checking the code of the input character. However, I encountered the fact that on mobile devices, when the numeric keypad opens, the characters "," and "." still pass.
The event does not even rise when these keys are pressed. If you try to enter periods and commas on the desktop, they do not work, but on the mobile it all breaks down.
Similar behavior can be seen on the learn.javascript page , which talks about phone number validation: on desktop, the dot is not skipped, but on mobile it is easy.
Actually the question is: how to make validation so that the symbols of dots and commas are still caught on mobile devices.
PS I have not encountered such problems with other characters.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question