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

jQuery addBack() Method

jQuery Traversal Methods

The addBack() method adds the previous set of elements in the stack to the current set, which canSelectThroughselectorExpression to filter.

Syntax:

$("selector").addBack("selectorExpression")

Example

In the list item3、4and5Add background to the following:

$("document").ready(function(){
  $("li.third-$("li.third").nextAll().addBack().css("background"-color", "coral");
});
Test See‹/›

Parameter Value

ParameterDescription
selectorExpressionA string containing a selector expression to match the current set of elements (optional)

jQuery Traversal Methods