This is my Login.php
I used a javascript to use some validation on my Login but sometimes it doesn't work and sometimes it does. I can't find the problem in my code.
This is the head.php
<script type="text/javascript" src="javascript/jquery.validate.js"></script>
What can I do to make it work all the time?
<div class="widget">
<h2>Login</h2>
<div class="inner">
<script type="text/javascript">
$().ready(function() {
// validate signup form on keyup and submit
$("#login").validate({
rules: {
password: {
required: true,
minlength: 8,
maxlength: 15
},
username: {
required: true,
minlength: 3,
},
},
messages:{
password:{
required: "Password is required.",
minlength: "Password must be 8-15 characters only.",
maxlength: "Password must be 8-15 characters only."
},
username:{
required: "Username is required",
minlength: "Username must be 2 or more characters."
},
}
});
});
</script>
<style type="text/css">
form.cmxform label.error, label.error {
/* remove the next line when you have trouble in IE6 with labels in list */
padding-top:3px;
color: red;
font-style: italic;
font-size: 11px;
float: none;
text-align: left;
margin-left:5px;
width: 100px;
}
</style>
<form name="login" id="login" class="cmxform" action="login.php" method="post">
<ul id="login">
<li>
Username:<br>
<input style="width:100%" type="text" name="username">
</li>
<li>
Password:<br>
<input style="width:100%" type="password" name="password">
</li>
<li>
<input type="submit" Value="Login">
</li>
<li></li>
</ul>
</form>
</div>
</div>