jQuery中捕获回车键
开发过程中,需要捕获回车键。(如:敲回车键完成登录动作等等。)
以下通过jQuery捕获回车键。
?
$(document).ready(function(){ $("html").die().live("keydown",function(event){ if(event.keyCode==13){ alert("捕获到回车键!"); } }); ); ?
?
使用jQuery1.5版本,在火狐、谷歌、IE下测试通过!