I have the following:
$("#pmtForm").validate({
rules: {
acct_name: "required",
acct_type: "required",
acct_routing: {
required: true,
digits: true,
exactLength:9
},
acct_num: {
required: true,
digits: true
},
c_acct_routing:{
equalTo: '#acct_routing'
},
c_acct_num: {
equalTo: '#acct_routing'
}
},
messages: {
acct_name: "<li>Please enter an account name.</li>",
acct_type: "<li>Please choose an account type.</li>",
acct_routing: "<li>Please enter a routing number.</li>",
acct_num: "<li>Please enter an account number.</li>",
c_acct_routing: "<li>Please confirm the routing number.</li>",
c_acct_num: "<li>Please confirm the account number.</li>"
},
errorPlacement: function(error, element) {
$('#errorList').html("");
$('#errorList').append(error);
$('div.error').attr("style","display:block;");
}
});
I am trying to insert error messages in a div above a form. My problem is that I am deleting this line: $ ('# errorList'). Html ("); then it displays error messages for the first time. If I click send one more time, it will add another set of messages to the div. If I save $ ('# errorList'). Html (" "); then I will get only one error message.
Enter your account number.How to update the error list so that it does not repeat and correctly display error messages?
early.
source
share