I'm trying to customizing Jquery validation. I happened to change the style of the error message. How to change style of input? I need to change border color, if success - green border, if error - red border. And if success - add
<span class="glyphicon glyphicon-ok" style="color:green;"> inside input.
If if success - green border - already work.
HTML:
<form role="form" action="" id="contact-form" >
<div class="form-group">
<div class="controls" >
<input type="text" class="form-control" name="login" placeholder="LOGIN*"
maxlength="15">
</div>
</div>
</form>
CSS:
<style>
.valid {
border-color: green;
}
label.error {
font-family:Tahoma;
font-size:11px;
color: red;
padding-left: 8px;
}
</style>
JS:
$(document).ready(function(){
$('#contact-form').validate({
rules: {
login: {
minlength: 2,
required: true
}
},
highlight: function(element) {
$(element).closest('.form-group').removeClass('success').addClass('error');
},
success: function(element) {
element
.text('OK!').addClass('valid')
.closest('.form-group').removeClass('error').addClass('success');
}
});
});