最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Customize ios keyboard to show numeric keyboard - Stack Overflow

programmeradmin0浏览0评论

I am working on a hybrid apps where I need to display numeric keyboard with dot and comma for iOS. I tried the pattern [0-9] with type as number. It works for android but does not show dot/comma for iOS. Anyone has any idea how to achieve this for iOS ? i tried searching for cordova plugin. Did not get any. I created a custom keyboard in angular. But it is having some delay for iOS when i provide any input. I need below attached keyboard in html5 input field. For ios i don't get dots using "input type="number" min="0" inputmode="numeric" pattern="[0-9]*"".

Please see attached screenshot

I am working on a hybrid apps where I need to display numeric keyboard with dot and comma for iOS. I tried the pattern [0-9] with type as number. It works for android but does not show dot/comma for iOS. Anyone has any idea how to achieve this for iOS ? i tried searching for cordova plugin. Did not get any. I created a custom keyboard in angular. But it is having some delay for iOS when i provide any input. I need below attached keyboard in html5 input field. For ios i don't get dots using "input type="number" min="0" inputmode="numeric" pattern="[0-9]*"".

Please see attached screenshot

Share Improve this question edited May 18, 2016 at 20:16 Bhaskar Hazarika asked May 18, 2016 at 7:01 Bhaskar HazarikaBhaskar Hazarika 811 gold badge1 silver badge4 bronze badges 1
  • were you able to find a solution to this? – dariru Commented Jul 4, 2017 at 7:53
Add a comment  | 

3 Answers 3

Reset to default 14

2019 Update

For anyone coming from Google looking for a working solution, this is now possible with the inputmode attribute as of iOS 12.3.

So something like <input type="number" pattern="[0-9]*" inputmode="decimal"> will show the numeric keyboard with a dot/comma for Android/iOS 12.3+, and the regular numeric keyboard for older iOS devices - note that inputmode has to be set to "decimal".

More info available on MDN.

its will works Android and iOS

  <input type="number" pattern="[0-9]*" inputmode="numeric">

You can use something like,

<input type="number" pattern="[0-9]*" inputmode="numeric">

Update :

You can do something like,

 EditText myEditText = (EditText)findViewById(R.id.myEditText);
 myEditText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);

Or:

 <input type="tel" />

or

 <input type="number" step="0.01">

You can refer this stackoverflow question.

Hope this will help :)

发布评论

评论列表(0)

  1. 暂无评论