[英]jQuery Validation errorPlacement is not working
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
我相信errorLabelContainer
会胜过errorPlacement
。 前者旨在将所有错误显示在一个地方,从而使后者多余,因此不使用。
在您的情况下,您希望在其父代具有ID=error-messages
的UL
中发生所有错误
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.