jQueryがフォームの検証を完了すると、成功ページにリダイレクトするフォームがあります。フォームの検証後のリダイレクト
私は間違っていますか?
$("#submit").click(function() {
if ($("#employeeID").val() == "") {
$("#message1").html("Employee ID can't be null");
}
if ($("#password").val() == "") {
$("#message2").html("Password can't be null");
}
});
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form name="loginform" method="post" class="login-form">
<div class="form-group">
<label for="employeeID">EmployeeID</label><input type="text" name="employeeID" id="employeeID" placeholder="employeeID" class="form-control" /><span id="message1"></span><br>
<label for="password">Password</label> <input type="password" name="password" id="password" placeholder="password" class="form-control" /><span id="message2"></span><br>
<input type="submit" id="submit" value="Login" />
<p class="message">Not registered? <a href="/validationSpringMVC/createAccount.html">Create an account</a></p>
</div>
</form>
@AniketSahrawat yup .. we can :) –