zoukankan      html  css  js  c++  java
  • jquery validate name相同通过id验证

         $(function () {
                if ($.validator) {
                    //fix: when several input elements shares the same name, but has different id-ies....
                    $.validator.prototype.elements = function () {
                        var validator = this,
                            rulesCache = {};
                        // select all valid inputs inside the form (no submit or reset buttons)
                        // workaround $Query([]).add until http://dev.jquery.com/ticket/2114 is solved
                        return $([]).add(this.currentForm.elements)
                            .filter(":input")
                            .not(":submit, :reset, :image, [disabled]")
                            .not(this.settings.ignore)
                            .filter(function () {
                                var elementIdentification = this.id || this.name;
                                !elementIdentification && validator.settings.debug && window.console && console.error("%o has no id nor name assigned", this);
                                // select only the first element for each name, and only those with rules specified
                                if (elementIdentification in rulesCache || !validator.objectLength($(this).rules()))
                                    return false;
                                rulesCache[elementIdentification] = true;
                                return true;
                            });
                    };
                }
            });
  • 相关阅读:
    Web Browser使用技巧
    Excel 函数
    删除文件夹, 解决源文件名长度大于文件系统支持的长度问题
    Send Mail using C# code
    动态规划——最长回文子串
    字符串处理总结
    打印日期
    A+B
    对称矩阵
    最小年龄的3个职工
  • 原文地址:https://www.cnblogs.com/silences/p/7274604.html
Copyright © 2011-2022 走看看