I have a form, trying to validate using jquery.validate.js but its not working
Form
<form id="login_form" name="login_form" method="post" action="" enctype="multipart/form-data" >
<div class="form-group">
<label for="user_email">Email address</label>
<input class="form-control" id="user_email" name="user_email" type="email" placeholder="Enter email">
</div>
<div class="form-group">
<label for="user_password">Password</label>
<input class="form-control" id="user_password" id="user_password" type="password" placeholder="Password">
</div>
<input type="submit" name="submit" id="submit" value="Login" class="btn btn-primary btn-block" />
</form>
And below is the Javascript/JQuery
<!-- Bootstrap core JavaScript-->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="vendor/jquery-easing/jquery.easing.min.js"></script>
<script src="jquery_validation_1_17_0/dist/jquery.validate.js"></script>
<script type="text/javascript">
$().ready(function() {
$("#login_form").validate({
rules: {
exampleInputEmail1: {
required: true,
email: true
},
exampleInputPassword1: {
required: true
}
},
messages: {
email: "Please enter a valid email address",
password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
}
}
});
});
</script>
I don't know why the validation part is not working.
I have tried some stuff like adding novalidate in form, but i think the function is not getting initiated.
Please help.
$(document).ready(function() {.. please keep eyes on console for errors