Я действительно работал следующим образом
HTML
<div class="control-group">
<label for="name" class="control-label">
Name:<em>*</em></label>
<div class="controls">
<input type="text" id="name"></div>
</div>
Jquery
$("#form1").validate({
rules: {
gender: "required",
name: "required"
},
messages: {
gender: " - Please select gender",
name: " - Please enter your name"
},
errorElement: "span",
errorPlacement: function(error, element) {
element.siblings("label").append(error);
},
highlight: function(element) {
$(element).closest('.control-group').removeClass('success').addClass('error');
},
success: function(element) {
element
.text('OK!').addClass('valid')
.closest('.control-group').removeClass('error').addClass('success');
}
});
CSS
.control-group.error input, .control-group.error select, .control-group.error textarea { border-color: #b94a48;}
.control-group.error .control-label, .control-group.error .help-block, .control-group.error .help-inline { color: #b94a48; }
.control-group.success input, .control-group.success select, .control-group.success textarea { border-color: #468847; }
.control-group.success .control-label, .control-group.success .help-block, .control-group.success .help-inline { color: #468847; }