<script src="js/jquery.min.js"></script>
<script>
//点击表单“提交”按钮
$(function login(){
$("#login").bind("click", function () {
var url = "${pageContext.request.contextPath}/checkLogin.action";
//更改form的action
$("#lginAndregist").attr("action", url);
//触发submit事件,提交表单
$("#lginAndregist").submit();
});
});
</script>
<form action="" method="post" id="lginAndregist" name="lginAndregist">
<input type="text" name="userName" class="userName" placeholder="userName">
<input type="password" name="userPassword" class="userPassword" placeholder="userPassword">
<button id="login" onclick="login()">登录</button>
<button id="regist" onclick="regist()">注册</button>
<div class="error"><span>+</span></div>
</form>
jq设置action并且提交
最新推荐文章于 2022-07-30 17:29:30 发布