title: How to use closest() in jQuery
body: <p>I am trying to get value of a text box by using closest().
  My form contains dynamically created table with one text box and button in each row . I want to show the value of text box in button click event. 
  Table format is given below</p>
  
  <pre><code>&lt;table id="dataarea" class="table"&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;jaison&lt;td&gt;
              &lt;td class="amountclm"&gt;
                  &lt;input id="txtamt" class="amtcls" type="text" value="100"&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;button id="schedule" class="schbtn btn btn-primary" type="button" onclick="UpdateSchedule()"&gt;Confirm&lt;/button&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;ARUN&lt;td&gt;
              &lt;td class="amountclm"&gt;
                  &lt;input id="txtamt" class="amtcls" type="text" value="500"&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;button id="schedule" class="schbtn btn btn-primary" type="button" onclick="UpdateSchedule()"&gt;Confirm&lt;/button&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I have written one javascript code (given below) . when the code will execute, it return a null value. </p>
  
  <p>Function</p>
  
  <pre><code>function UpdateSchedule() {
      var amt2 = $(this).closest('td.amountclm').find('.amtcls').val();
      alert( amt2); 
  }
  </code></pre>
  
  <p>Please let me know why am not getting the null value.</p>