Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquery验证,当输入字段具有title属性时,而不是错误消息title作为错误消息给出_Jquery_Jquery Validate - Fatal编程技术网

jquery验证,当输入字段具有title属性时,而不是错误消息title作为错误消息给出

jquery验证,当输入字段具有title属性时,而不是错误消息title作为错误消息给出,jquery,jquery-validate,Jquery,Jquery Validate,嗨,我正在使用jquery验证插件 我有一个奇怪的问题,我有一个像这样的镇静剂 jQuery("#profile_info").validate({ rules : { city : { required : true, minlength : 3, maxlength : 30, cityvalidation: true }, state :

嗨,我正在使用jquery验证插件

我有一个奇怪的问题,我有一个像这样的镇静剂

jQuery("#profile_info").validate({

    rules : {
        city : {
            required : true,
            minlength : 3,
            maxlength : 30,
            cityvalidation: true
        },
        state : {
            required : true,
            minlength : 3,
            maxlength : 30,
            cityvalidation: true
        }
    },
    messages : {
        city : {
            required : " City must be  filled in",
            minlength : "At least 3 characters long",
            maxlength : "Should not exceed 30 characters",
        },
        state : {
            required : " State must be  filled in",
            minlength : "At least 3 characters long",
            maxlength : "Should not exceed 30 characters",
        }
    }
});
cityvalidation

jQuery.validator.addMethod("cityvalidation", function(value, element) {
      return this.optional(element) || /^[a-zA-Z\u0080-\u024F\s\/\-\)\(\`\.\"\']+$/i.test(jQuery.trim(value));
    }, "You Have Typed Unallowed Charactors");
我的输入字段是

                                                    <div class="select-date-container-side location-codes">
                                                        <input id="city" name="city"
                                                            value="<?php if(isset($profileinfo['CityName'])){echo $profileinfo['CityName'];}else if(isset($city)){echo $city;} ?>"
                                                            title="City" type="text"
                                                            class="smaler-textfield textfield clear-default"
                                                            tabindex="1900" />
                                                    </div>
                                                    <div class="select-date-container-middle location-codes">
                                                        <input id="state" name="state"
                                                            value="<?php if(isset($profileinfo['StateName'])){echo $profileinfo['StateName'];}else if(isset($state)){echo $state;} ?>"
                                                            title="State" type="text"
                                                            class="smaler-textfield textfield clear-default"
                                                            tabindex="1900" />
                                                    </div>

嗯,我找到了

我使用了
ignoreTitle:true,

jQuery("#profile_info").validate({


    ignoreTitle: true,

    rules : {
        city : {
            required : true,
            minlength : 3,
            maxlength : 30,
            cityvalidation: true
        },
        state : {
            required : true,
            minlength : 3,
            maxlength : 30,
            cityvalidation: true
        }
    },
    messages : {
        city : {
            required : " City must be  filled in",
            minlength : "At least 3 characters long",
            maxlength : "Should not exceed 30 characters",
        },
        state : {
            required : " State must be  filled in",
            minlength : "At least 3 characters long",
            maxlength : "Should not exceed 30 characters",
        }
    }
});