jQuery 验证未显示消息
jQuery Validation not showing message
我是 jQuery 验证的新手,无法使用它。我只是想弹出一条消息,说缺少名字。此脚本中是否缺少任何内容?
<!-- Validate -->
<script type="text/javascript" src="jquery.validate.min.js"></script>
$(document).ready(function(){
$("#form").validate({
firstname_1: { required:true },
//same for your other fields
}, {
messages: {
firstname_1: "Missing first name",
}
});
<cfform name="form" id="form" method="post">
<cfoutput><input type="text" name="firstname_#Add#" id="firstname_#Add#" placeholder="First" validateat="onSubmit" validate="noblanks" required="yes" message="Please enter owner #Peoplecount#'s first name." value="#session.checkout.info["firstname_" & Add]#"></cfoutput>
您 .validate()
的论据有误。它只需要一个选项参数,验证规则在该参数中:
$("#form").validate({
rules: {
firstname_1: {
required: true
},
// Same for other fields
},
messages: {
firstname_1: "Missing first name",
// Repeat for other fields
}
});
我是 jQuery 验证的新手,无法使用它。我只是想弹出一条消息,说缺少名字。此脚本中是否缺少任何内容?
<!-- Validate -->
<script type="text/javascript" src="jquery.validate.min.js"></script>
$(document).ready(function(){
$("#form").validate({
firstname_1: { required:true },
//same for your other fields
}, {
messages: {
firstname_1: "Missing first name",
}
});
<cfform name="form" id="form" method="post">
<cfoutput><input type="text" name="firstname_#Add#" id="firstname_#Add#" placeholder="First" validateat="onSubmit" validate="noblanks" required="yes" message="Please enter owner #Peoplecount#'s first name." value="#session.checkout.info["firstname_" & Add]#"></cfoutput>
您 .validate()
的论据有误。它只需要一个选项参数,验证规则在该参数中:
$("#form").validate({
rules: {
firstname_1: {
required: true
},
// Same for other fields
},
messages: {
firstname_1: "Missing first name",
// Repeat for other fields
}
});