jQuery API jQuery API 中英文对照版 - jQuery在线查询手册
not(elems)
not(elems)

从匹配的元素集合中删除所有符合条件的元素集合。这个函数用于从jQuery对象中删除一个或多个元素。

返回值:jQuery

参数:

  • elems (jQuery): 要从匹配的jQuery元素集合中删除的元素集合
 
示例:

从全部段落的集合中删除所有与“div p.selected”匹配的元素。

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

HTML 代码:

<div><p>Hello</p><p   class="selected">Hello Again</p></div>

结果:

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

Removes any elements inside the array of elements from the set of matched elements. This method is used to remove one or more elements from a jQuery object.

Please note: the expression cannot use a reference to the element name. See the two examples below.

Return value: jQuery
Parameters:

  • elems (jQuery): A set of elements to remove from the jQuery set of matched elements.
 

Example:

Removes all elements that match "div p.selected" from the total set of all paragraphs.

 $("p").not( $("div p.selected") )  
Before:
 <div><p>Hello</p><p class="selected">Hello Again</p></div>  
Result:
 [ <p>Hello</p> ]