title: jquery closest tr and finding an element
body: <p>I have the following code</p>
  
  <pre><code>&lt;form name="frm1"&gt;
  &lt;table id="mytable" border="1" cellspacing="2" cellpadding="2"&gt;
      &lt;tr&gt;
          &lt;td&gt;
              column1
          &lt;/td&gt;
          &lt;td&gt;
              column2
          &lt;/td&gt;
          &lt;td&gt;
              column3
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;
              ABC
          &lt;/td&gt;
          &lt;td&gt;
              &lt;select name="mydd" class="mydd"&gt;
                  &lt;option value="ABC"&gt;ABC&lt;/option&gt;
                  &lt;option value="DECF"&gt;DECF&lt;/option&gt;
                  &lt;option value="GHHHH"&gt;GHHHH&lt;/option&gt;
              &lt;/select&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;input type="text" name="textvalue" id="textvalue" value="kljaslkjd"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;
              ABC
          &lt;/td&gt;
          &lt;td&gt;
              &lt;select name="mydd" class="mydd"&gt;
                  &lt;option value="222"&gt;222&lt;/option&gt;
                  &lt;option value="333"&gt;333&lt;/option&gt;
                  &lt;option value="444"&gt;444&lt;/option&gt;
              &lt;/select&gt;
          &lt;/td&gt;
          &lt;td&gt;
              &lt;input type="text" class="textvalue" name="textvalue" id="textvalue" value="kljaslkjd"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>jquery code as below:</p>
  
  <pre><code>$(document).ready(function(){
      $(".mydd").change(function(){
        var value= $(this).closest("tr").find(".textvalue").attr("name");
         alert('value:' + value);
      });
  });
  </code></pre>
  
  <p>What I am trying to do is, when I change the drop down option, I am getting the closest tr, and then finding for an input element. The first element is always returning undefined. But the second element works fine. What could be the reason?</p>