title: How to add class to first child with jQuery?
body: <p>How do I add a class an element on a container with a certain index?</p>
  
  <p>I'm trying this right now which should affect the first element (doesn't work anyway)</p>
  
  <pre><code>$('#resultsBox li:first-child').addClass('aaaa');
  </code></pre>
  
  <p>But I want to be able to change class of any element in it's container having the index.</p>
  
  <p>EG if I want to modify element with index = 2.</p>
  
  <pre><code>&lt;div id="resultsBox"&gt;
  &lt;ul&gt;
  &lt;li&gt;&lt;/li&gt;
  &lt;li&gt;&lt;/li&gt;
  &lt;li&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Should become:</p>
  
  <pre><code>&lt;div id="resultsBox"&gt;
  &lt;ul&gt;
  &lt;li&gt;&lt;/li&gt; // Index 0
  &lt;li&gt;&lt;/li&gt; // Index 1
  &lt;li class="selected"&gt;&lt;/li&gt; // Index 2
  &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>