代码如下
<!DOCTYPE html>
<html>
<body>
<link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui/css/layui.css" />
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<button type="submit" class="layui-btn" lay-submit="" onclick="$('#submit').click()">立即提交</button>
<form action="http://www.baidu.com" onsubmit="return sub()">
<input type="submit" id="submit" style="display: none;" value="提交" />
</form>
<script>
function sub(){
alert(1)
return false;
}
</script>
</body>
</html>