如何检测textarea上箭头键的按键事件? [英] How to detect key down event for arrow key on textarea?

查看:387
本文介绍了如何检测textarea上箭头键的按键事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建以下html页面:

Create the following html-page:

<textarea id="code" rows="10"></textarea>
<script>
  document.onkeydown = function(event) {
    alert(event.keyCode);
  }
</script>

移动Safari上打开(在模拟器或设备上键盘),点击textarea开始编辑。然后按任意箭头键 - 事件不会触发。

Open it on Mobile Safari (on a simulator or on a device with keyboard), tap on textarea to start editing. And now press any arrow key - event won't fire.

如何检测箭头键的按键?

How to detect key down for arrow keys?

PS苹果Bug报告系统的相关问题:13243285

P.S. Related issue on Apple Bug Report system: 13243285

推荐答案

Apple的官方回答:

Official answer from Apple:


感谢您联系Apple开发人员技术支持(DTS)。我们的
工程师已经审查了您的请求,并得出结论,在
目前的运输系统配置下,有
不支持实现所需功能。

Thank you for contacting Apple Developer Technical Support (DTS). Our engineers have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configurations.

这篇关于如何检测textarea上箭头键的按键事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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