jQuery验证errorPlacement方法未激发。事实上,唯一触发的方法是showErrors。我想我漏掉了什么。代码如下。
errorContainer: '#error-messages',
showErrors: function (errors) {
$("#error-messages").dialog({
modal: true,
title: 'Errors',
buttons: {
Ok: function () {
$(this).dialog("close");
}
}
});
return true;
},
errorLabelContainer: "#error-messages ul",
wrapper: "li",
errorPlacement: function (error, element) {
if (element.attr('name') == 'a') {
error.appendTo($('#restErrorDate'));
}
},
debug: true发布于 2013-01-14 08:30:39
我相信errorLabelContainer会胜过errorPlacement。前者旨在将所有错误显示在一个位置,而后者则是冗余的,因此无法使用。
在本例中,您需要父对象具有ID=error-messages的UL中的所有错误
https://stackoverflow.com/questions/14309863
复制相似问题