0
我想爲我的字段驗證添加自定義錯誤消息,而不是使用默認的錯誤消息,但它嘗試許多不同的選項後無法正常工作。以下是我的代碼片段。請幫忙!使用jquery驗證添加自定義錯誤消息
$('#myform').validate({ // initialize the plugin
submitHandler: function (form) {
console.log("Submitted!");
},
rules: {
accountNumber: {
required: true,
minlength: 8,
maxlength: 8,
min: 11111111,
digits: true
},
companyNumber: {
required: true,
digits: true
}
},
messages: {
min: 'Account number cannot be 00000000',
max: 'Account number cannot be 00000000',
digits: 'The account number must be a number'
}
});
});
完美...謝謝!! – sam