我尝试使用自定义错误消息,但是当出现错误时,当我按下正文或按钮errorPlacement
时,它会不断重复。Send Message
下面是我的 jQuery 代码,这是我的jsfiddle
$(document).ready(function () {
$("#myform").validate({
rules: {
message: {
required: true,
minlength: 5,
maxlength: 753
}
},
debug: true,
errorPlacement: function (error, element) {
error.appendTo('#invalid');
},
messages: {
message: {
required: "Enter your text message",
minlength: jQuery.format("Enter at least {0} characters"),
}
}
});
});