jQuery keyup keyCode doesn't work in Opera

让人想犯罪 __ 提交于 2020-01-14 13:58:29

问题


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


回答1:


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/




回答2:


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).



来源:https://stackoverflow.com/questions/3624812/jquery-keyup-keycode-doesnt-work-in-opera

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!