title: JQuery get the first td by clicking a button on the same row
body: <p>This might be a simple question, however I tried everything and it didn't work.    </p>
  
  <p>I would like to click a button that is on the 3rd td to get the the text of the first td. The HTML code looks like this:</p>
  
  <pre><code>&lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;Name&lt;/td&gt;
          &lt;td&gt;Age&lt;/td&gt;
          &lt;td&gt;Btton&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Tom&lt;/td&gt;
          &lt;td&gt;21&lt;/td&gt;
          &lt;td&gt;&lt;input type="button" id="b" value="alert" onclick="alert1();" /&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>As I mentioned I tried different things, for example</p>
  
  <pre><code>function alert1() {
      alert($(this).closest("tr").first().text());
  }
  </code></pre>
  
  <p>However, it alerts with an empty box. Not sure what I am doing wrong.</p>
  
  <p>Thank you for your time.</p>