Having trouble with my login form validation using jQuery. Can someone help me fix it?
$(document).ready(function() {
$("#form1").validate({
rules: {
username: {
required: true,
minlength: 6
},
password: {
required: true,
minlength: 5
}
},
messages: {
username: {
required: "Username is mandatory"
}
}
});
});
.error {
color: red;
}
p {
font-size: 13px;
font-style: arial;
font-align: left;
}
body {
font-family: calibri, arial, sans-serif;
background-color: powderblue;
margin: 0;
padding: 0;
border: 0;
outline: 0;
}
span.password {
float: right;
padding-top: 50px;
}
.login-form {
margin-top: 5%;
margin-bottom: 5%;
position: relative;
width: 390px;
left: 35%;
height: 500px;
border: 6px solid#ff0000;
padding: 10px;
background-color: #00ffff;
}
.login-form h1 {
font-size: 50px;
text-align: center;
text-transform: uppercase;
margin: 40px;
}
.login-form label {
font-size: 29px;
text-align: right margin:45px;
}
.login-form input[type=text],
.login-form input[type=password] {
font-size: 20px;
width: 350px;
padding: 10px;
border: 0;
outline: none;
border-radius: 5px;
}
.login-form button {
font-size: 16px;
color: white;
background-color: green;
font-weight: bold;
padding: 79px;
width: 60%;
margin: 10px 15px;
padding: 8px 6px;
border: 5px;
cursor: pointer;
}
.login-form button:hover {
border: solid black;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="jquery-validation/dist/jquery.validate.min.js">
</script>
<script src="js/bootstrap.min.js"></script>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.js"></script>
<div class="login-form">
<h1>LOGIN PAGE</h1>
<form action="#" name="form1" id="form1">
<label for="firstname">First Name</label>
<input type="text" name="firstname" id="firstname" placeholder="username"><br>
<br>
<label for="password">Password</label>
<input type="password" name="password" id="password" placeholder="pswd"><br>
<input name="submit" type="submit" id="submit" class="submit" value="Submit">
<span>
<input type="checkbox" id= "remember" name="remember " value="remember me">
<label for ="checkbox" name="checkbox" >Remember me</label>
</span>
<span class="password">Forget <a href="#" >Password ?</a></span>
</form>
</div>