码迷,mamicode.com
首页 > Web开发 > 详细

JqueryValidate 修改 为根据ID验证

时间:2017-06-28 18:59:52      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:filter   tle   assign   not   query   elements   tor   eset   mit   

<!--修改validate根据ID验证  -->
<script type="text/javascript">
if ($.validator) {
    $.validator.prototype.elements = function () {
        var validator = this,
          rulesCache = {};

        // select all valid inputs inside the form (no submit or reset buttons)
        return $(this.currentForm)
        .find("input, select, textarea")
        .not(":submit, :reset, :image, [disabled]")
        .not(this.settings.ignore)
        .filter(function () {
            if (!this.name && validator.settings.debug && window.console) {
                console.error("%o has no name assigned", this);
            }
            //注释这行代码
            // select only the first element for each name, and only those with rules specified
            //if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) {
            //    return false;
            //}
            rulesCache[this.name] = true;
            return true;
        });
    }
}

</script>


//直接将此代码copy至你要更改验证方式的页面即可

 

JqueryValidate 修改 为根据ID验证

标签:filter   tle   assign   not   query   elements   tor   eset   mit   

原文地址:http://www.cnblogs.com/miye/p/7090670.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!