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://myzitong.com/article/pgchjs.html