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