Is there a way to force the number keyboard to come up on the phone for an <input type="text">
? I just realized that <input type="number">
in HTML5 is for “floating-point numbers”, so it isn’t suitable for credit card numbers, ZIP codes, etc.
I want to emulate the numeric-keyboard functionality of <input type="number">
, for inputs that take numeric values other than floating-point numbers. Is there, perhaps, another appropriate input
type that does that?
You can do <input type="text" pattern="\d*">
. This will cause the numeric keyboard to appear.
See here for more detail: Text, Web, and Editing Programming Guide for iOS
<form>
<input type="text" pattern="\d*">
<button type="submit">Submit</button>
</form>