jQuery end()
The end()
method in jQuery is used to end the most recent filtering operation or chain and return the set of matched elements to its previous state.
Syntax
The end()
method can be used with or without parameters.
Without parameters:
$(selector).filter(criteria1).end();
With parameters:
$(selector).filter(criteria1).next().end(criteria2);
Use
The end()
method can be used in chaining to end the most recent filtering operation and return the set of matched elements to its previous state. This can be useful when you want to filter a set of elements, perform an operation on the filtered elements, and then return to the original set of elements.