强制数字键盘在ipad上为contenteditable元素 [英] Force Number keyboard on ipad for contenteditable element
问题描述
我在保留应用程序的几个部分中使用了contenteditable。由于我们正在记录时间,当然,我希望键盘能够自动切换到ipad用户的数字键盘。我已经尝试将所有属性添加到我能想到的元素中,例如:
I'm using contenteditable in several sections of our time keeping app. Since we're logging time, naturally, I want the keyboard to automatically switch to the number keyboard for ipad users. I've tried adding all the attributes to the elements that I can think of such as:
- Type = number
- Type = tel
- pattern = [0-9] *
但是ipad仍然会加载默认键盘。
but ipad still loads the default keyboard.
以下是一个例子:
<div class="editable validate numbers-only" contenteditable="true" type="number" pattern="[0-9]*">3</div>
我可以使用任何技巧来显示我的ipad用户的数字键盘吗?
Are there any tricks that I can use to display the number keyboard for my ipad users?
推荐答案
这只是带我进去:)
我发现:
手机开发 - 如何显示数字键盘?
this just took me in :) I found this: Iphone Development - How to display a numeric keyboard?
不确定你是否随身携带它,但是当我输入时它改变了键盘布局
not sure if you get anywhere with it, but it changed the keyboard layout when I put in
onKeypress="if(event.keyCode < 48 || event.keyCode > 57){return false;}"
<或许可以摆弄一下。我没有时间来测试:)(并且还没有评论)。
欢呼
maybe fiddle around a little. I haven't got all the time to test :) (And can't comment yet). cheers
这篇关于强制数字键盘在ipad上为contenteditable元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!