jQueryValidationPlugin

index.html

成都创新互联成都网站建设按需定制,是成都网站建设公司,为阳光房提供网站建设服务,有成熟的网站定制合作流程,提供网站定制设计服务:原型图制作、网站创意设计、前端HTML5制作、后台程序开发等。成都网站改版热线:13518219792





Insert title here




    // add the customized method 
	$.validator.addMethod("test",function(value,element,params){
		var flag = false;
		if(typeof(value)!=null&&parseInt(value)>10){
			flag = true;
		}
		return this.optional(element) || flag;
	},"the input value must be larger that 10");


	$(function(){
		$("#form").validate({
            submitHandler: function(form) {
                alert("pass ... ");
            },
            rules: {
                username: {
                    required:true
                },
                password:{
                	required:true,
                	minlength:6
                },
                email:{
                	required:true,
                	email:true
                },
                testField:{
                	required:true,
                	test:true
                }
            },
            messages: {
                username: {
                    required:"please input the username"
                },
                password:{
                	required:"please input the password",
                	minlength:"the password must be six characters at least"
                },
                email:{
                	required:"please input the email",
                	email:"the email format is wrong!"
                },
                testField:{
                	required:"please input the testField",
                }

            }//end messages
        });
	});



	
		

附件:http://down.51cto.com/data/2365952

网页名称:jQueryValidationPlugin
网页链接:http://csdahua.cn/article/pgchjs.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流