Kumar Manish
Kumar Manish

Reputation: 1175

How to open a number pad on android/chrome with <input type="text">?

Requirement of input is to enter the zip code of United states so it would be 5 integers but it is just a bunch of strings to the application. Markup is HTML5.

So input type="text" pattern="[0-9]*" works on iPhone iPad safari browsers but does not work on chrome browsers in android devices.

Anyone knows how to get a number pad to open using input type="text" on android devices using chrome browsers? Or 'input type="tel"' is the only way to open a number pad universally on all devices?

Similar question asked sometime back Phone: numeric keyboard for text input

Upvotes: 9

Views: 5865

Answers (2)

sfletche
sfletche

Reputation: 49714

A little late to the party I know but...

Using pattern="\d*" should work...

<input type="text" pattern="\d*">` 

Upvotes: 3

Valentin Roudge
Valentin Roudge

Reputation: 565

Input 'tel' was created to enter this type of data and to be cross-device. Using it is smart to input numbers, even though it's text. You're over-thinking this.

Upvotes: 0

Related Questions