开发者

Event Evaluation

When does a JavaScript event like keydown actually get evaluated. ie. Till when can one use event.preventDefault() or similar methods to prevent the action from being taken.

I haven't had any luck in trying to find a pattern. All I know that is that if the prevent is executed at the beginning or a statement lat开发者_运维技巧er, it works(prevents action) but a little later, it doesn't.

Is there any reference for this?


It's probably browser dependent. If you want to prevent the default then that instruction should always be the first (no motif not to be, it's instantaneous) and only then follow up with your code.

check the example in http://api.jquery.com/keydown/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜