我正在为我的注册表单使用 jquery 验证,它运行良好,但我遇到了问题。我检查电子邮件是否存在,如果电子邮件确实存在,我会收到一条错误消息。现在我想编辑这个,所以,如果电子邮件是免费使用的。错误消息将更改为:此电子邮件可免费使用。
$(document).ready(function(){
$("#registratieform").validate({
rules: {
email: {
required: true,
email: true,
remote: {
url: "includes/check_email.php",
type: "post",
complete: function(data){
if( data.responseText == "false" ) {
alert("Free");
}
}
},
},
},
messages: {
email: {
required: "This field is required",
email: "Please enter a valid email address",
remote: jQuery.format("{0} is already taken")
},
},
});
});
警报有效,但此消息必须出现在错误所在的标签中。这可能吗?