layui中标准用法如下:
<form class="layui-form">
<input type="button" id="queryCondBtn" class="layui-btn" lay-submit lay-filter="queryCondBtn" value="提交">
</form>
form.on('submit(queryCondBtn)', function(data){
// 相关操作
});
layui.use(['form','jquery','layer'],function(){
var form = layui.form,
$ = layui.jquery,
layer = layui.layer;
form.on("submit(queryCondBtn)",function(data){
console.log(data);
//书写自己的逻辑...
return false;
});
});
$(#XXX).keydown(function (e) {
if (e.keyCode === 13) {
$("#queryCondBtn").trigger("click");
}
});
<div class="layui-form-item" style="margin-bottom: 20px;">
<input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
<a href="forget.html" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码?</a>
</div>
<div class="layui-form-item">
<button id="LAY-user-login-submit" class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登 入</button>
</div>
<div class="layui-trans layui-form-item layadmin-user-login-other">
--------------------------------------------------
$('#LAY-user-login-password').on('keydown', function (event) {
if (event.keyCode == 13) {
$("#LAY-user-login-submit").trigger("click");
return false
}
});