'using JQuery to submit username and password , if it correct then go to another html
I am working with jquery.validate.min.js, but I have a problem is that I can't go to(link?) another HTML page or something like that after clicking on submit. This is my first question on this site, I can't post all code because of discard draft
This is my code
<script src="jquery-3.6.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#formtest").validate({
rules:{
email:{
required:true,
email:true
},
password:{
required:true
}
},
messages:{
email:{
required:"enter email",
email:"please try agin"
},
password:{
required:"enter password",
}
}
});
});
function SubmitIfValid()
{
if(!$("#formtest").validate()) return false;
return true;
}
</script>
</head>
<body>
<form id="formtest" action="www.google.com" method="POST" class="col" name="form1" >
<label for="exampleInputEmail1" class="col-sm-3 form-label">Email:</label>
<div class="col-sm-6 mb-3">
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter your email" name ="email"/>
</div>
<label class="col-sm-1"></label>
<label for="exampleInputPassword1" class="col-sm-3 form-label">Password:</label>
<div class="col-sm-6 mb-3">
<input name="password" type="password" class="form-control" id="exampleInputPassword1"
placeholder="Enter your password" >
</div>
<div class="mb-3">
<label class="col-sm-8"></label>
<input type="submit" value="submit" onclick="return SubmitIfValid();" />
</div>
</form>
</section>
</section>
</fieldset>
</form>
</section>
</div>
</body>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
