简体   繁体   English

移动键盘上字母数字的 html 5 输入类型

[英]html 5 input type for alphanumeric on mobile keyboard

We have seen when input type "Text" selected on mobile keyboard it comes up with text, when input type "number" selected on mobile keyboard it comes up with numbers only.我们已经看到,当在移动键盘上选择输入类型“文本”时,它会出现文本,当在移动键盘上选择输入类型“数字”时,它只会出现数字。 And when input type password fields are selected then it comes up with both alphabet and numbers. And when input type password fields are selected then it comes up with both alphabet and numbers. Is there any way to show both alphabet and numbers on keyboard when input field are not password, rather plain text??当输入字段不是密码而是纯文本时,有没有办法在键盘上同时显示字母和数字?

像这样

Hope you got my query.希望你能得到我的询问。 Thanks.谢谢。

Please see this example for different kinds of keyboard inputs on mobile devices. 有关移动设备上不同类型的键盘输入,请参阅示例。

The keyboard that is closest to your wishes is probably the 'password' keyboard: 最接近您愿望的键盘可能是“密码”键盘:

<input type="password">

Try:尝试:

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

Before html5.1 via css:在 html5.1 之前通过 css:

 input[type=number] {
    -webkit-text-security: disc;
}
*<form>
  <input type="number" pattern="[0-9]*" inputmode="numeric">
  <button type="submit">Submit</button>
</form>*

this should work too putting the type as number这也应该可以将类型作为数字

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM