jQuery keyup keyCode 在 Opera 中不起作用

发布于 2024-09-17 08:29:25 字数 294 浏览 3 评论 0原文

Opera 浏览器是否有可能忽略 keyCode 40(向下箭头)?

 $('#test').keyup(function(e) {
        $('body').append('' + e.keyCode + '');
 })

测试它: http://www.jsfiddle.net/V9Euk/454/

谢谢提前!
彼得

Is it possible that the opera browser ignore the keyCode 40 (arrow down)?

 $('#test').keyup(function(e) {
        $('body').append('' + e.keyCode + '');
 })

Test it at: http://www.jsfiddle.net/V9Euk/454/

Thanks in advance!
Peter

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

败给现实 2024-09-24 08:29:33

是的,这不起作用(好像 Opera 不支持它)。
看看这个来自 www.w3.org 的测试页面显示你的浏览器检测到了什么(keyup 没有被触发)。

Yes, this does not work (seems like opera does not support it).
Have a look at this test page from www.w3.org showing you what your broswer detects (keyup is not fired).

故笙诉离歌 2024-09-24 08:29:31

尝试使用autocomplete属性,并将其设置为off

<input id="test" value="" autocomplete="off" >

Opera使用向下箭头键进行自动完成,因此可能会抑制事件的转发。

工作测试:http://www.jsfiddle.net/V9Euk/455/

Try to use the autocomplete attribute, and set it to off:

<input id="test" value="" autocomplete="off" >

Opera uses the arrow down key for auto completion, and may therefore suppress the forwarding of the event.

Working test: http://www.jsfiddle.net/V9Euk/455/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文