判断是否按了回车键
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<input type="text" value="" id="inp1">
</body>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).keydown(function(event){ //监听键盘按下时的事件
console.log(event.keyCode); //按下不同的按键,对应的event.keyCode也不同
if(event.keyCode == 13){
console.log('回车键')
}
});
</script>
</html>