title: JQuery : Get div defined in same table row
body: <p>I have an HTML table created dynamically using an MVC application and the output of the table is as shown below: </p>
  
  <p>In the <code>onclick</code> event of the edit button I want to show <code>divText</code> and hide <code>divLabel</code> of the same row using jQuery. </p>
  
  <p>I have tried to get <code>divLabel</code> as shown below: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function EditRecord(elem) {
    var divlabel = $(elem).closest('tr').children('td div#divLabel');
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;div id="divLabel"&gt;
          value 1
        &lt;/div&gt;
        &lt;div id="divText" style="display: none"&gt;
          &lt;input type="text" value="value 1" /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;input type="button" value="edit" onclick="EditRecord(this);" /&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;div id="divLabel"&gt;
          value 2
        &lt;/div&gt;
        &lt;div id="divText" style="display: none"&gt;
          &lt;input type="text" value="value 1" /&gt;
        &lt;/div&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;input type="button" value="edit" onclick="EditRecord(this);" /&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>But it is not working for me. </p>