Javatpoint Logo
Javatpoint Logo

jQuery addBack() method

The addBack() method is used to add the previous set of elements to the current set. It is optionally filtered by the selector. It is an inbuilt method in jQuery.


The selector mentioned in the above syntax is the optional parameter of the addBack() method. It specifies a string that contains a selector expression to match the elements against.

Let's understand the working of the addBack() method using an illustration.


In this example we are applying the addBack() method to the paragraph element with id = "p1". Here, we are also using the nextAll() method to select the next paragraph siblings of the paragraph element with id = "p1".

Test it Now


jQuery addBack() method

After clicking the given button, the output will be -

jQuery addBack() method

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA