a bitch?
Basically i have an html input with type=number. The idea is that my input element shouldn't set any non numeric value.
So things like 1.1 1. .1 are valid but alphanumerics (1.. mk $#) aren't.
I tried to set type to number, inputMode to numeric and i set the pattern attribute to a regex according to my needs, that's all working on chrome but not on safari. It seems to ignore pattern and type
I've seen people dealing with this using onkeypress and e.preventDefault() after some js logic but i am afraid that might misses something on mobiles since keycodes and keys in general don't work the same
The leading question made me lol
I don't think they ignore the pattern. They still allow entering non-numeric input, but won't validate it.
they respect pattern and type in the sense that they consider the input invalid, but they don't reject it as chrome does.
Yeah, but that's not really necessary when inputmode can hint the appropriate keyboard. Similar to say when you define a pattern for a text input that does not allow numbers, and Chrome won't reject entering digits.
Обсуждают сегодня