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