title: Select first and last element with particular class using jQuery
body: <p>I have a list of spans with particular class "place" and some of them have class "activated". Is there a way to select the first item with class "activated" and the last? </p>
  
  <pre><code>&lt;span class="place" onclick="activate();"&gt;1&lt;/span&gt;
  &lt;span class="place" onclick="activate();"&gt;2&lt;/span&gt;
  &lt;span class="place activated" onclick="activate()"&gt;3&lt;/span&gt;
  &lt;span class="place activated" onclick="activate();"&gt;4&lt;/span&gt;
  &lt;span class="place activated" onclick="activate();"&gt;5&lt;/span&gt;
  &lt;span class="place activated" onclick="activate();"&gt;6&lt;/span&gt;
  &lt;span class="place" onclick="activate();"&gt;7&lt;/span&gt;
  </code></pre>