如何在不使用输入类型数字/电话的情况下在移动设备上显示小键盘?
我已经调查过了,但似乎找不到任何东西。由于我正在进行一些验证,我有一个输入无法转换为数字输入。我想知道如何在不使用 input
类型 number
/tel
的情况下显示小键盘?
最佳答案
在理想的世界中,这正是inputmode
属性会让你这样做。
User agents can support the inputmode attribute on form controls (such as the value of textarea elements), or in elements in an editing host (e.g., using contenteditable).
The inputmode content attribute is an enumerated attribute that specifies what kind of input mechanism would be most helpful for users entering content.
你可以像这样使用它:
<input type="text" inputmode="numeric">
但是,截至目前,it has limited support仅在某些最新版本的 Chrome 和移动版 Chrome 中可用。
关于javascript - 如何在不使用输入类型数字/电话的情况下在手机上显示小键盘?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51047298/