jQuery.validator.methods

该对象包含验证器已知的所有验证方法。可以访问此选项以覆盖单个方法,同时保留默认消息。

例如,验证邮箱

jQuery.validator.methods.email = function (value, element) {

        var email = /\w+([-+.]\w+)*@@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
        return this.optional(element) || email.test(value);
    };

猜你喜欢

转载自blog.csdn.net/weixin_39041271/article/details/79609047
今日推荐