The usage of jQuery 'end()' function
<p>i go to the site <a href="http://api.jquery.com/end/" rel="nofollow">http://api.jquery.com/end/</a> just to understand how end() use and how it works. unfortunately i just do not understand what it does. so i need to know in what kind of situation end() should be used.</p>

<h2>here is small example</h2>

<pre><code>&lt;ul class="first"&gt;
  &lt;li class="foo"&gt;list item 1&lt;/li&gt;
  &lt;li&gt;list item 2&lt;/li&gt;
  &lt;li class="bar"&gt;list item 3&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class="second"&gt;
  &lt;li class="foo"&gt;list item 1&lt;/li&gt;
  &lt;li&gt;list item 2&lt;/li&gt;
  &lt;li class="bar"&gt;list item 3&lt;/li&gt;
&lt;/ul&gt;

 $('ul.first')
         .find('.foo')
         .css('background-color', 'red')
         .end()
         .find('.bar')
         .css('background-color', 'green');
</code></pre>

<p>i just do not understand what kind of role <code>end()</code> function play here.</p>

<p>it would be great if someone help me to understand the usage of <code>end()</code> function with small &amp; easy sample code. please help. thanks</p>
