hi guys i have a problem i am searching for it but couldnt find that code right.can any one fix it.i want to change my text field colour to red while it is left empty or doesnt specify the condition applied on this...here is my code below

<!doctype html>
<html>
<head>
<script src="jquery.js"></script>
<script src="validate.js"></script>

<script>
$(document).ready(function(){


   $("#register").validate({
   
   
   rules:{
   
   name:{
   required: true,
   minlength: 6,
   
   },
   email:{
   
   required: true,
   email: true,
   
   },
   password:{
   
   required: true,
   minlength: 6,   
   },
   
   
   }
   
   
   
   });

  
  


});




</script>


<style>

label {
width: 150px;
display: inline-block;

}

</style>

</head>
<body>

<form id="register">
<label>Name</label>
<input type="text" name="name"/><br />

<label>Email</label>
<input type="text" name="email"/><br />

<label>Password</label>
<input type="text" name="password"/><br />

<label></label>
<input type="submit" name="submit"/><br />

</form>


</body>
</html>
Member Avatar
text.error {
    background-color:red;
}

In your css. *I think*

BTW, I think this:

<label>Password</label>
<input type="text" name="password"/><br />

should be:

<label>Password</label>
<input type="password" name="password"/><br />