html5 input type number with regex pattern
11,795
You could use input type "text" for only the validation purpose.
<input type="text" pattern="[0-9\/]*" >
You can consider the "tel" input type, for a simpler keybord layout containing the slash on a mobile device
<input type="tel" pattern="[0-9\/]*">
Comments
-
UI_Dev almost 2 years
I'm trying to get regex pattern in input type number to show only numbers and forward slash. I tried something like this.
<input type="number" pattern="[0-9\/]*">
But getting only 0-9 number pad. How can I show 0-9 number pad as well as forward slash
"/"
in regex.