can't fire keypress event when press delete key

后端 未结 2 903
迷失自我
迷失自我 2021-02-12 19:28

I\'m finding that the delete key doesn\'t fire the keypress event in Chrome, while other keys work. The problem doesn\'t occur in Firefox, just in chrome, why? Here

2条回答
  •  攒了一身酷
    2021-02-12 19:53

    keypress event for (Del, End, Home,etc..) is not fired in IE, Chrome and safari.. it only works in firefox..

    so you can use the keyup or keydown event because the keypress event is intented for real (printable) characters. "keydown" is handled at a lower level so it will capture all non-printing keys like DEL, End, etc

提交回复
热议问题