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;
                            });
                    };
                }
            });
  • 相关阅读:
    ansible-handlers
    LNMP
    编译安装sshpass
    cadence-irun(xrun) 增量编译
    sva 基础语法
    bsub && lsf 介绍
    Perl 输出内容到 excel
    Perl sendmail
    dlopen与dlsym用法
    perl在linux下通过date获取当前时间
  • 原文地址:https://www.cnblogs.com/silences/p/7274604.html
Copyright © 2011-2022 走看看