I am new here and would like a little help if possible. I have a form that I am validating but would like to also highlight the error fields as well as keep the popover. I can't work out what is wrong?
It is on jsfiddle here - http://jsfiddle.net/mKF5L/75/
$('form').validate({
rules: {
name: {
required: true
},
email: {
required: true,
email: true
},
subject: {
required: true,
minlength: 10
},
comment: {
required: true,
minlength: 10,
maxlength: 200
}
},
highlight: function (element) {
$(element).closest('.form-group').addClass('has-error');
},
unhighlight: function (element) {
$(element).closest('.form-group').removeClass('has-error');
},
showErrors: function (errorMap, errorList) {
$.each(this.successList, function (index, value) {
$(value).popover('hide');
});
$.each(errorList, function (index, value) {
console.log(value.message);
var _popover = $(value.element).popover({
trigger: 'manual',
placement: 'top',
content: value.message,
template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><div class="popover-content"><p></p></div></div></div>'
});
_popover.data('bs.popover').options.content = value.message;
$(value.element).popover('show');
});
}
});
Can anyone tell me what I am doing wrong please?
Thanks in advance
Gary.