Nikhil
Nikhil

Reputation: 379

Showing only Numeric keypad for ios cordova application

I am working on a Cordova application. Is there a way we can show a keypad on iOS devices like the image shown below

this

This can be achieved in Android by setting the input type='number', but in IOS it doesn't work. Need some help!

Adding input type='number' in ios shows a keypad like the image shown below

like this

Upvotes: 2

Views: 3738

Answers (2)

Rami Alloush
Rami Alloush

Reputation: 2626

What worked for me is decimal in inputmode

<input type="number" inputmode="decimal"/>

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode

Upvotes: 1

Younes Zaidi
Younes Zaidi

Reputation: 1190

You need To specify the pattern Use like this :

<input type="number" pattern="\d*"/>

Upvotes: 3

Related Questions