jQuery绑定键盘事件
开始之前可以先了解一下 keyCode 键盘键码值表:
给某一元素绑定事件:
/*监听document的回车操作*/ $('document').bind('keypress', function(event){ if(event.keyCode == "13"){ // do something... } });
没错,其实就是这么简单。
author:Lik
Endeavoring to powerless, struggling to move yourself.
Endeavoring to powerless, struggling to move yourself.