title: Traverse the following axis in the DOM
body: <p>This is a DOM fragment.</p>
  
  <pre><code>&lt;p class="target"&gt;1&lt;/ p&gt;
  &lt;p class="click"&gt;&lt;/ p&gt;
  &lt;table&gt;
  &lt;tr&gt;&lt;td&gt;&lt;p class="click"&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  &lt;p class="target"&gt;2&lt;/p&gt;
  </code></pre>
  
  <p>I would like to find the next p with the <code>target</code> class, it doesn't matter on what DOM level the p pressed with the<code>click</code> class is. In the case p with value 2</p>
  
  <p>Something like</p>
  
  <pre><code>$ ("p.click").click(function () {
  target = $(this).following("p.target").first()
  });
  </code></pre>
  
  <p>But I can not find how to traverse the following axis in the DOM, except, maybe,  xpath which does not work in all browsers.</p>
  
  <p>It would be great if I don't know something :) </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I was not correct enough writing the question. More suitable code is below. After pressing <code>click</code> I want to get the first <code>error</code> after</p>
  
  <pre><code>&lt;input class="click" type="button" value="1"&gt;
  &lt;p class="error"&gt;&lt;/ p&gt;
  &lt;table&gt;
  &lt;tr&gt;&lt;td&gt;&lt;input class="click" type="button" value="2"&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  &lt;p class="error"&gt;&lt;/p&gt;
  </code></pre>