Cancel the keydown in HTML

后端 未结 6 918
清歌不尽
清歌不尽 2020-11-29 10:28

How can I cancel the keydown of a specific key on the keyboard, for example(space, enter and arrows) in an HTML page.

6条回答
  •  迷失自我
    2020-11-29 10:37

    Just return false. Beware that on Opera this doesn't work. You might want to use onkeyup instead and check the last entered character and deal with it. Or better of use JQuery KeyPress

提交回复
热议问题