not
英 [nɒt] 美 [nɑ:t]
adv.不;[用以表示否定、否认、拒绝、禁止等]不是;几乎不;未必,没有[用于否定后面的词或短语]
jquery not()方法 语法
作用:not() 从匹配元素集合中删除元素。
语法1:.not(selector)
参数:
| 参数 | 描述 |
| selector | 字符串值,包含用于匹配元素的选择器表达式。 |
语法2:.not(element)
参数:
| 参数 | 描述 |
| element | 一个或多个需要从匹配集中删除的 DOM 元素。 |
语法3:.not(function(index))
参数:
| 参数 | 描述 |
| function(index) | 用于检测集合中每个元素的函数。this 是当前 DOM 元素。 |
说明:如果给定一个表示 DOM 元素集合的 jQuery 对象,.not() 方法会用匹配元素的子集构造一个新的 jQuery 对象。所应用的选择器会检测每个元素;不匹配该选择器的元素会被包含在结果中。
jquery not()方法 示例
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js></script>
</head>
<body>
<p>This is a paragragh.</p>
<p>This is a paragragh.</p>
<p>This is a paragragh.</p>
<p id="selected">This is a paragragh.</p>
<p>This is a paragragh.</p>
<p>This is a paragragh.</p>
<script>
$("p").not("#selected").css('background-color', 'red');
</script>
</body>
</html>点击 "运行实例" 按钮查看在线实例
热门推荐
- 如何在mysql中使用BETWEEN和NOT BETWEEN进行范围查询
- composer怎么处理“Package ... is not compatible with this version of PHP”_说明解决依赖与PHP版本不兼容问题
- 如何在mysql中使用IN和NOT IN条件
- composer如何解决 root 用户运行时的 “Do not run Composer as root/super user!” 警告
- composer提示 “Your PHP version ... does not satisfy that requirement” 如何处理
- windows10如何解决“class not registered”的错误_windows10系统注册问题修复方法