微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

html – 如何使输入字段类型数字和密码?

参见英文答案 > Is there a way to have a masked numeric input field?1
我知道这个:
<input type="tel">

我知道这一点:

<input type="password">

但我想使用两者.我想要数字键盘在iOS上(具体来说),但是在打字后隐藏每个字符.有可能吗?

<input type="tel|password">

解决方法

对于iOS,您可以将输入设置为键入“密码”,并仍然使用HTML5属性“模式”触发数字键盘
<input type="password" pattern="[0-9]*" ... />

Apple-Documentation

To display a numeric keyboard,set the value of the pattern attribute to “[0-9]” or “\d“.

原文地址:https://www.jb51.cc/html/231014.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐