title: Select the first and last "td" elements with the class "selected" in 2 separate tables
body: <p>I have 2 separate tables, every one of the td elements can contain "selected" class, how can I select the first and last td elements with "selected" class in both tables.</p>
  
  <pre><code>&lt;table class="table1"&gt;
      &lt;tr&gt;
          &lt;td&gt;Jill&lt;/td&gt;
          &lt;td class="selected"&gt;Smith&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="selected"&gt;Hill&lt;/td&gt;
          &lt;td class="selected"&gt;Morris&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  
  &lt;table class="table2"&gt;
      &lt;tr&gt;
          &lt;td class="selected"&gt;Mills&lt;/td&gt;
          &lt;td&gt;Garyn&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Lee&lt;/td&gt;
          &lt;td&gt;Gutierrez&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>The first item is the "td" with the class "selected" is Smith, and the last one is "Mills"</p>