enter键提交表单

type='sumbit'时默认enter键提交表单

但如果用的是ajax提交时,type="button",enter键提交不了,所以只好用js去捕捉onkeydown事件~

document.onkeydown = function(e){
e
= e || window.event;
if(e.keyCode === 13){
//这里放你的代码
}
};

原文地址:https://www.cnblogs.com/mofish/p/2090223.html