:not() 选择器选取除了指定元素以外的所有元素。 最常见的用法:与其他选择器一起使用,选取指定组合中除了指定元素以外的所有元素 语法 $(":not(selector)") 实例 选取除了 class="intro" 元素以外的所有 <p> 元素: $("p:not(.intro)")
selector:一个用来过滤的选择器。 所有的选择器可以放置在:not()中,例如:not(div a)和:not(div,a)。 Additional Notes(其他注意事项): .not()方法可以让代码更易读。而使用:not()通常会构建出一个非常复杂的选择器。所以大多数情况下,推荐使用.not()方法。
:not() 选择器选取除了指定元素以外的所有元素。 最常见的用法:与其他选择器一起使用,选取指定组合中除了指定元素以外的所有元素(如上面的实例)。 语法 $(":not(selector)") 参数描述 selector必需。规定不选择的元素。 该参数接受任何类型的选择器。
:lt(index) 小于,获取索引小于 index 的元素 :not(selector):获取除指定选择器以外的其他元素 4、内容选择器 :contains(text):获取内容包含 text 文本的元素 :empty:获取内容为空的元素 :has(selector) :获取内容包含指定选择器的元素 :parent :获取内容不为空的元素(特殊) 5、可见性选择器 :hidden:获取所有...
说明: 匹配找到的最后一个元素.与 :first 相对应.3、:not(selector) 用法: $("input:not(:checked)") 返回值 集合元素 说明: 去除所有与给定选择器匹配的元素.有点类似于”非”,意思是没有被选中的input(当input的 type=”checkbox”).4、:even ...
not() 方法返回不符合一定条件的元素。 该方法让您规定一个条件。不符合条件的元素将从选择中返回,符合条件的元素将被移除。 该方法通常用于从被选元素组合中移除一个或多个元素。 提示:not() 方法是与filter()方法相对的。 语法 $(selector).not(criteria,function(index)) ...
:not() jQuery:not()Selector ❮ jQuery Selectors Example Select all <p> elements except those with class="intro": $("p:not(.intro)") Try it Yourself » Definition and Usage The :not() selector selects all elements except the specified element....
not selector Description:Selects all elements that do not match the given selector. version added:1.0jQuery( ":not(selector)" ) selector:A selector with which to filter by. All selectors are accepted inside:not(), for example::not(div a)and:not(div,a). ...
:not(selector) not表示排除掉的意思,所以这个简单伪类选择器表示获取相反的其他元素。代码参考教材2.1.4节。 :first :last :odd :even 选择集合中的第一项、最后一项、偶数行项、奇数行项。代码参考教材2.1.4节。 :eq :lt :gt 选择集合中的某一项,选择集合中所有小于指定的项、选择集合中所有大于指定项的项...
语法:$(“not(selector)”) 作用:不包括指定内容的元素 代码语言:javascript 代码运行次数:0 运行 AI代码解释 // 改变class不为 one 的所有 div 元素的背景色为 红色" id="b3 $("#b3").click(function () { $("div:not(.one)").css("backgroundColor","red"); }); 4、偶数选择器 语法:$(“...