Jqery验证生日 [英] Jqery validate for birthday
问题描述
< SCRIPT SRC = https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.18.0/jquery.validate.js >< /脚本>
将SCRIPT SRC = https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.18.0/additional-methods.js >< /脚本>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.18.0/jquery.validate.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.18.0/additional-methods.js"></script>
$(document).ready(function () {
$('#formsub').validate({ // initialize the plugin
rules: {
Email: {
required: true,
email: true
},
//field2: {
// required: true,
// minlength: 5
//}
}
});
});
我尝试过:
i requrid生日验证。
i有datepicker,我必须验证员工是否少于18岁然后不允许。 (给出验证消息)
What I have tried:
i requrid birthday validation.
i have datepicker and i have to validate if employee is less then 18 years then not allow. (give validation msg)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.18.0/jquery.validate.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.18.0/additional-methods.js"></script>
推荐答案
(document).ready(function(){
(document).ready(function () {
('#formsub')。validate({ //初始化插件
规则:{
电子邮件:{
required:true,
email:true
},
// field2:{
//必填:true,
// minlength:5
//}
}
});
});
('#formsub').validate({ // initialize the plugin rules: { Email: { required: true, email: true }, //field2: { // required: true, // minlength: 5 //} } }); });
我的尝试:
i requrid生日验证。
i有datepicker,我必须验证员工是否少于18年,然后不允许。 (给出验证消息)
What I have tried:
i requrid birthday validation.
i have datepicker and i have to validate if employee is less then 18 years then not allow. (give validation msg)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.18.0/jquery.validate.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.18.0/additional-methods.js"></script>
您需要创建一个自定义例程来添加新的验证功能。这需要在你的两次CDN通话之后和你的验证程序之前。
You will need to create a custom routine to add a new Validation function. This will need to be after your two CDN calls and before you have your validation routine.
这篇关于Jqery验证生日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!