I want to change the class that jQuery Validate applies to inputs that have an error
Change this
<input id="firstname" name="firstname" type="text" value="" maxlength="100"
class="error">
to this
<开发者_开发百科input id="firstname" name="firstname" type="text" value="" maxlength="100"
class="customErrorClass">
Try specifying the errorClass
property:
$('.selector').validate({
errorClass: 'customErrorClass',
rules: { ... },
messages: { ... }
});
The one can use code as following for Custom Css
<style>
.myErrorCssClass {
border: solid 1px #ff0000;
}
</style>
<script>
$('#form1').validate({
errorClass: "myErrorCssClass",
rules: {
Name: {
required: true,
minlength: 3,
maxlength: 10
},
LastName: {
required: true
}
}
})
</script>
精彩评论