0

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>
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by diafol
0
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 />

Edited by diafol: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.