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

结束最近的“破坏性”操作,把匹配的元素列表回复到前一个状态。在调用end函数后,匹配的元素列表会回复到上一个操作之前的匹配元素列表状态。

如果前面的操作(对元素列表的状态)没有破坏性,则什么也不改变。

返回值:jQuery

示例:

选择所有段落,并在它们中查找span元素,然后恢回复到选择所有段落的状态。

$("p").find("span").end();

HTML 代码:

<p><span>Hello</span>, how are   you?</p>

结果:

[ <p>...</p> ] 
 
end()

Revert the most recent 'destructive' operation, changing the set of matched elements to its previous state (right before the destructive operation).

If there was no destructive operation before, an empty set is returned.

A 'destructive' operation is any operation that changes the set of matched jQuery elements. These functions are: add, children, clone, filter, find, not, next, parent, parents, prev and siblings.

Return value: jQuery
Example:

Selects all paragraphs, finds span elements inside these, and reverts the selection back to the paragraphs.

 $("p").find("span").end();  

Before:

 <p><span>Hello</span>, how are you?</p>  
Result:
 [ <p>...</p> ]