title: Get the Id of current table row with Jquery
body: <p>Hi I have the following code in a form . When the user clicks a button I want to get the current row in order to identify which of the buttons was clicked </p>
  
  <pre><code>&lt;tr  id="TEST1" &gt;
      &lt;td align="left" valign="middle"&gt;
          &lt;div align="right"&gt;Contact&lt;/div&gt;
      &lt;/td&gt;
      &lt;td colspan="4" align="left" valign="middle"&gt;
          &lt;input type="text" id="contact1" size="20" /&gt;  Number 
          &lt;input type="text" id="number1" size="20" /&gt; 
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="button"  value="Button 1" id="contact1" /&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr id="TEST2" &gt;
      &lt;td align="left" valign="middle"&gt;
          &lt;div align="right"&gt;Contact&lt;/div&gt;
      &lt;/td&gt;
      &lt;td colspan="4" align="left" valign="middle"&gt;
          &lt;input type="text" id="contact2" size="20" /&gt;  Number 
          &lt;input type="text" id="number2" size="20" /&gt; 
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="button"  value="Button 1"  id="contact2" /&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr id="TEST3" &gt;
      &lt;td align="left" valign="middle"&gt;
          &lt;div align="right"&gt;Contact&lt;/div&gt;
      &lt;/td&gt;
      &lt;td colspan="4" align="left" valign="middle"&gt;
          &lt;input type="text" id="contact3" size="20" /&gt;  Number 
          &lt;input type="text" id="number3" size="20" /&gt; 
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="button"  value="Button 1"  id="contact2" /&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I thought the following Jquery would return the ID name but it doesn't </p>
  
  <pre><code>$('input[type=button]' ).click(function() {
      bid = (this.id) ; // button ID 
      trid = $('tr').attr('id'); // table row ID 
  });
  </code></pre>
  
  <p>Can anyone give me some advice please ?  thanks </p>