title: How to select consecutive elements that match a filter
body: <p>Given this example:</p>
  
  <pre><code>&lt;img class="a" /&gt;
  &lt;img /&gt;
  &lt;img class="a" /&gt;
  &lt;img class="a" id="active" /&gt;
  &lt;img class="a" /&gt;
  &lt;img class="a" /&gt;
  &lt;img /&gt;
  &lt;img class="a" /&gt;
  </code></pre>
  
  <p><em>(I've just used img tags as an example, that's not what it is in my code)</em></p>
  
  <p>Using jQuery, how would you select the img tags with class "a" that are adjacent to #active (the middle four, in this example)?</p>
  
  <p>You could do it fairly easily by looping over all the following and preceding elements, stopping when the filter condition fails, but I was wondering if jQuery could it natively?</p>