本文介绍了jQuery,REAL:不是运营商的等价物吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码行选择任何div中的所有子输入,他的类名不是id和quantity::

this code line select all the children inputs inside any div who his class name is not "id" and "quantity" ::

$("div.item > div:not(.id,.quantity) > :input").live("keydown",function(event) {});

执行相反的代码行是什么?,类似于: :

$("div.item > div:filter(.id,.quantity) > :input").live("keydown",function(event) {});

(当然:过滤器不是有效的jQuery选择器)

( of course :filter is not a valid jQuery selector )

推荐答案

我不知道我是否会推荐这个,但你可以使用 :不是两次:

I don't know if I would recommend this, but you can use :not twice:

$("div.item > div:not(:not(.id,.quantity)) > :input")

更好的方法是创建你的拥有:是选择器

A better way is to create your own :is selector

$.expr[':'].is = function(elem, index, match){
    return $(elem).is(match[3]);
};

$("div.item > div:is(.id,.quantity) > :input")

这篇关于jQuery,REAL:不是运营商的等价物吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 08:07