用not过滤返回的jQuery对象

来源:互联网 发布:鹊桥佣金数据哪里查看 编辑:程序博客网 时间:2024/06/05 06:25
            // 不用 not, 有点啰嗦            $("#divFloor [data-bind]").each(function () {                var element = $(this);                if (!element.hasClass("rt-element")) {              // 排除包含rt-element類元素                    element.attr("disabled", "disabled");           // disabled對象                }            });            // 用 not,代码明显简洁了            $("#divFloor [data-bind]").not(".rt-element").each(function () {                $(this).attr("disabled", "disabled");            });