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;
                            });
                    };
                }
            });
  • 相关阅读:
    【计算机网络】SSL交互和握手过程
    【LDAP】ldap目录服务的命名模型
    运维知识体系概览
    linux安装Django 以及 生产环境部署实现高并发
    xss过滤代码
    python单列模式
    JSONP
    组合搜索
    KindEditor
    登录验证码
  • 原文地址:https://www.cnblogs.com/silences/p/7274604.html
Copyright © 2011-2022 走看看