jQuery Validate表单验证

1.这个属性导致表单多个相同name的标签只有一个会被验证;所以注释掉了

复制代码
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,button")
                .not(":submit, :reset, :image, [disabled]")
                .not(this.settings.ignore)
                .filter(function () {
                    !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;
                    if (!validator.objectLength($(this).rules()))
                        return false;

                    return true;
                });
            },
复制代码

2.现象:标签没有id也不会被验证

posted @   言凡  阅读(191)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示