I am using Jquery Validation on a user control as such:
$("#form1").validate({
rules: {
<%=textb.UniqueID %>:
{
required: true
},
},
messages: {
<%=textb.UniqueID %>:
{
required: "Please Enter value",
},
},
highlight: function(element, errorClass, validClass) {
//$(element).css({ backgroundColor: '#0f0' });
$(element).addClass(errorClass).removeClass(validClass);
},
unhighlight: function(element, errorClass, validClass) {
//$(element).css({ backgroundColor: '#fff' });
$(element).removeClass(errorClass).addClass(validClass);
}
});
This is the CSS I am using:
.error input {
color: #b92d23;
}
.error {
background: #000;
}
Now I can see the error and valid classes added to the input/textbox. but the CSS won't take effect to change the background colour.
If I do $(element).css({ backgroundColor: '#fff' }); it changes the colour but want to do it from CSS file(I can see my other CSS class but not error).
In firebug it looks like this :
<input type="text" class="UC_longtextfield error" id="mypage_txbLoanAmount" name="mypage$txbLoanAmount">
<label for="mypage_txbLoanAmount" generated="true" class="error">Please Enter value</label>