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也不会被验证

原文地址:https://www.cnblogs.com/-beauTiFul/p/8659964.html