title: Jquery Closest From Element Value
body: <p>Im trying to get a form element value using closest. Here some example code.</p>
  
  <pre><code>&lt;table&gt;
    &lt;tr&gt;
      &lt;td&gt;Hour &lt;input type="input" value="12" name="data[hour]" class="hour" /&gt;&lt;/td&gt;
      &lt;td&gt;Minute &lt;input type="input" value="12" name="data[minute]" class="minute" /&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href="#" class="add-data"&gt;Add Row&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>See I cant serialize the form because it is part of a large form so I need to grab each input closest to the add row link as yo will be able to add multiple rows.</p>
  
  <p>I have tried</p>
  
  <pre><code>var hour = $(this).closest('.hour').val();    
  var hour = $(this).closest('input', '.hour').val();
  var hour = $(this).closest('input[name="data[hour]]").val();
  </code></pre>
  
  <p>Any ideas how I can get the form values ?</p>
  
  <p>Thanks in advance</p>