title: jQuery selection: traversing up, then back down
body: <p>I am struggling with how to select a particular element with jQuery. Conditions outlined here:</p>
  
  <ul>
  <li>At the relevant point in my function, <code>this</code> references a <code>span</code>.</li>
  <li>That <code>span</code> may be a child, grand child, or great grand child, but somewhere up the hierarchy, it's contained by a <code>td</code>.</li>
  <li><strong>I'd like to select the last <code>span</code> inside of the <code>td</code>.</strong></li>
  <li>The <code>span</code> may be <code>this</code>, or it may be another <code>span</code>.</li>
  <li>The <code>span</code> tags to be selected is a direct child of the containing <code>td</code>, so <code>last-child</code> is workable. However, for future flexibility a solution that doesn't assume it's a direct child is preferred.</li>
  </ul>
  
  <p>So far, I am using this to select the correct parent element:</p>
  
  <pre><code>$(this).parents('td')
  </code></pre>
  
  <p>I don't know how to traverse back down the DOM tree to get the final <code>span</code> inside of the selected <code>td</code>. Thanks!</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Per my comments below, would also be nice to select from a <code>span</code> or <code>div</code>, whichever is last.</p>