Android html5 input type=“password” and numeric keyboard

随声附和 提交于 2019-12-30 07:39:07

问题


I am tasked with styling a web page for Android and iOS, where you are supposed to input your credit card information.

I can't get the security code field to open a numerical keyboard in Android.

This is the closest that I've come. It works on iOS, but not Android.

<input type="password" pattern="[0-9]*">

I am quite limited in what I am allowed to do:

  • No Javascript, only HTML and CSS modifications.
  • Input type must be password

Is it possible to get a password input field to open up a numerical keyboard in Android?


回答1:


Unfortunately it seems that it's impossible to do this purely in html and css.

However for webkit browsers you can use text-security attribute:

input[type=number] {
    -webkit-text-security: disc;
}

And then just use a number type (yes i've read that you can't use this):

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


来源:https://stackoverflow.com/questions/25484482/android-html5-input-type-password-and-numeric-keyboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!