0

I would like to prevent user from typing Arabic numbers ( ٠١٢٣٤٥٦٧٨٩ ) in text field with type number, how can I achieve this ?

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153
Hesham AbdAllah
  • 412
  • 6
  • 16
  • Maybe you should try this [solution](https://stackoverflow.com/a/19966612/10429440) – Timofey Goncharov May 06 '19 at 20:21
  • Realise that you're asking "how do I prevent people from typing numbers in a `type=number` input field" and that this question doesn't make a lot of sense from an HTML perspective: if you don't want your users to type numbers, but only ten very specific ASCII codes, then don't use `type="number"` attribute (which is for a number input field, for any locale and for whatever "numbers" mean in that locale), and instead use [the `pattern` attribute](https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Form_validation#Validating_against_a_regular_expression) to match against `[0-9]+` – Mike 'Pomax' Kamermans May 06 '19 at 22:05

0 Answers0