IPad在输入时禁用keyevent [英] IPad Disable keyevent on input

查看:117
本文介绍了IPad在输入时禁用keyevent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究一种实现向文本框添加文本的解决方案,但是我禁用了普通的键事件并使用了自定义事件。我禁用了这样的关键事件:

I am working on a solution that implements adding text to textboxes but I disable the normal key events and use a custom one. I disable the key event like this:

<input onkeypress="return false;"  onkeydown="return false;"  onkeyup="return false;" type="text">

现在这在浏览器(Safari,Firefox,IE)上工作正常,但它无法在IPad的Safari,当用户按下某个键时,会输入两次。还有另一种方法可以禁用ipad的输入字段上的键事件吗?

Now this works fine on browsers(Safari, Firefox, IE) but it fails to do so on the IPad's Safari and when a user press a key, it is entered twice. Is there another way to disable key events on the input field for the ipad?

推荐答案

我弄明白了。基本上,如果你要自定义键输入,你必须在键上自定义它,而不是在Javascript中按下键或按键。

I figured it out. Basically if you are going to customize key entry, you have to customize it on the key up and not the key down or key pressed in Javascript.

这篇关于IPad在输入时禁用keyevent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆