preventDefault() on keyup event not working

前端 未结 4 1036
不思量自难忘°
不思量自难忘° 2021-02-19 06:20

I cannot get preventDefault() to work.

Here are some different code variations I have tried:

First:

$(document).keyup(function (evt)         


        
4条回答
  •  孤街浪徒
    2021-02-19 06:50

    There is no default behaviour for .keyup(); it fires after the key press which triggers the default behaviour. Use .keydown() or.keypress()` instead.

    source: http://api.jquery.com/category/events/keyboard-events/

提交回复
热议问题