中文输入法onkeydown的bug

xiaoxiao2021-02-28  92

有个bug比较蛋疼,在中文输入法中监听e.keycode会一直是229,但是在英文输入法没有问题;解决办法是吧keydown事件换成keyup,就可以监听到正确的keycode了

<input type='text' id ='eTicket'></input> $('#eTicket').on('keydown',function(e){ console.log(e.keyCode) }) $('#eTicket').on('keyup',function(e){ console.log(e.keyCode) })

转载请注明原文地址: https://www.6miu.com/read-80866.html

最新回复(0)