我是新来的,如果可能的话,希望能得到一点帮助。我有一个正在验证的表单,但还想突出显示错误字段并保留弹出框。我不知道出了什么问题?
它在 jsfiddle 上 - 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');
});
}
});
谁能告诉我我做错了什么?
提前致谢
加里。