jQuery API 返回首页目录 | jQuery API 中英文对照版
not(expr)
not(expr)

从匹配的元素集合中删除与指定的表达式匹配的元素。这个函数用于从一个jQuery对象中删除一个或多个元素。

返回值:jQuery

参数:

  • expr (String): 用于匹配要删除元素的表达式
 
示例:

从所有段落中删除ID值为selected的元素。

$("p").not("#selected") 

HTML 代码:

<p>Hello</p><p id="selected">Hello   Again</p>

结果:

[ <p>Hello</p> ] 
 
not( expr )

Removes elements matching the specified expression from the set of matched elements. This method is used to remove one or more elements from a jQuery object.

Return value: jQuery
Parameters:

  • expr (String): An expression with which to remove matching elements
 

Example:

Removes the element with the ID "selected" from the set of all paragraphs.

 $("p").not("#selected")  

Before:

 <p>Hello</p><p id="selected">Hello Again</p>  
Result:
 [ <p>Hello</p> ]  

 

相关链接
asp之家 | jQuery官方网站 | jQuery中文网 | 电子书作者网站 | 电子书作者blog