English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery end() Method

jQuery Traversal Methods

The end() method ends the nearest filtering operation in the current chain and returns the matched element set to its previous state.

Syntax:

$(selector).end()

Example

Select all paragraphs, find the span element within them, and then restore the selected content to the paragraph:

$("button").click(function(){
  $("p").find("span").end().css("border", "2px solid red");
});
Test and See‹/›

jQuery Traversal Methods