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“.

相关文章

vue阻止冒泡事件 阻止点击事件的执行 &lt;div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些