0
jQuery验证方法errorPlacement
未触发。实际上,唯一触发的方法是showErrors
。我想我错过了一些东西。代码如下。jQuery验证errorPlacement不起作用
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
的errorContainer并去除,留下下面的相关项目的所有错误:仍然不工作 –
showErrors:功能(错误){ $(“#错误信息 “)对话框({ 模式:真, 标题: '错误', 按钮:{ 确定:函数(){$ (本).dialog(” 亲密“);} } }); 返回true; ('name')=='a'){ }, errorPlacement:function(error,element)if(element.attr('name')=='a'){ error.appendTo($('#restErrorDate')); } }, debug:true }); –
在jsfiddle.net中创建一个演示...可以包含CDN版本的验证插件以启用它 – charlietfl