代码 //监听回车键 $(document).keydown(function (e) { //输出按下的键码 console.log(e.keyCode); if(e.keyCode == 13){ $('#