This is a personal reminder, but I hope it may help you too.
I know that nowadays jQuery is not as popular as it used to be.
But sometimes I need to deal with it and I end up forgetting the
It's pretty simple and very useful. Take a look at this example from jQuery's website:
We need to apply two distinct colors for the items
Both the options above get the job done, but we can improve it with
Here we go down with
find, apply the color to
.foo and then return with
end to the point where we were before (
Before you ask me, I tell you, the
end() method just goes back one step at a time.
In the following example we need to call it twice to return to our starting point: