jQuery not() 方法

jQuery 教程 · 2019-03-28 09:19:12

实例

返回带有类名 "intro" 的所有 <p> 元素:

$("p").not(".intro")

定义和用法

not() 方法返回不符合一定条件的元素。

该方法让您规定一个条件。不符合条件的元素将从选择中返回,符合条件的元素将被移除。

该方法通常用于从被选元素组合中移除一个或多个元素。

提示:not() 方法是与 filter() 方法相对的。

语法

$(selector).not(criteria,function(index))

参数 描述
criteria 可选。规定要从被选元素组合中移除的选择器表达式、jQuery 对象、一个或多个元素。

提示:如需规定多个条件,请使用逗号分隔。
function(index) 可选。为组合中的每个元素规定要运行的函数。如果返回 true,则移除元素,否则元素将被保留。
  • index - 集合中元素的 index 位置。
注意: this 是当前的 DOM 元素。

点击查看所有 jQuery 教程 文章: https://www.codercto.com/courses/l/35.html

查看所有标签

Advanced Web Metrics with Google Analytics

Advanced Web Metrics with Google Analytics

Brian Clifton / Sybex / 2008 / USD 39.99

Are you getting the most out of your website? Google insider and web metrics expert Brian Clifton reveals the information you need to get a true picture of your site's impact and stay competitive usin......一起来看看 《Advanced Web Metrics with Google Analytics》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

随机密码生成器
随机密码生成器

多种字符组合密码

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试