title: How to select next matching element?
body: <p>This works:</p>
  
  <pre><code>&lt;a href="#/link1"&gt;link1&lt;/a&gt;
  &lt;a href="#/link2"&gt;link2&lt;/a&gt;
  &lt;a href="#/link3"&gt;link3&lt;/a&gt;
  
  $("a[href*='#/link1'").next('a[href*="#"]').click();
  </code></pre>
  
  <p>but this does not:</p>
  
  <pre><code>&lt;a href="#/link1"&gt;link1&lt;/a&gt;&lt;br&gt;
  &lt;a href="#/link2"&gt;link2&lt;/a&gt;&lt;br&gt;
  &lt;a href="#/link3"&gt;link3&lt;/a&gt;&lt;br&gt;
  
  $("a[href*='#/link1'").next('a[href*="#"]').click();
  </code></pre>
  
  <p>The above tests the "&lt; br >" tag, not the next matching link.</p>
  
  <p>How would I go about making it work in both situations. I want to select the next matching element, not the next element if it matches. Maybe .next() isn't the correct method?</p>