title: trying to get a form id with closest?
body: <p>for a little shopping cart i have multiple forms on a page. Each form represents the amount of a product with a bunch of action triggers. And outside the forms i also have a couple of data which i need to use. </p>
  
  <p>Anyway for this i need to get the form id corresponding to an action trigger.</p>
  
  <p>So i created a function which is called when an action button is clicked.</p>
  
  <pre><code>    function transferData() {
      // var form_id= $(this).closest("form").prop("id");
     // var form_id= $(this).prev("form").prop("id");
      var form_id= $(this).closest('td').parent().closest('form').prop('id');
  </code></pre>
  
  <p>action is triggered by</p>
  
  <pre><code>&lt;button name="submit[1]"  type="button"  onClick="transferData()" class="btn btn-info btn-sm"&gt;&lt;i class="fa fa-refresh"&gt;&lt;/i&gt;&lt;/button&gt;
  </code></pre>
  
  <p>html structure simplfy</p>
  
  <pre><code>&lt;tr&gt;&lt;form id="form_update[1]" name="form_update[1]" action="cart_update.php" method="post"&gt;&lt;td data-th="Product"&gt;&lt;div class="row"&gt;
                                  &lt;div class="col-sm-2 hidden-xs"&gt;&lt;img width="100" src="../images/frere.jpg" alt="Frere" class="img-responsive"/&gt;&lt;/div&gt;
                                  &lt;div class="col-sm-10"&gt;
                                      &lt;h4 class="nomargin"&gt;Frere&lt;/h4&gt;
                                      &lt;p&gt;bad boy frere&lt;/p&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;&lt;/td&gt;&lt;td data-th="Price"&gt;$25.00&lt;/td&gt;&lt;td data-th=""&gt;&amp;nbsp;&lt;/td&gt;&lt;td data-th="Quantity"&gt;
                              &lt;input type="number" min="0" name="item_qty_summary[1]" class="form-control text-center" value="4"&gt;
                          &lt;/td&gt;&lt;td data-th="Subtotal" class="text-right" &gt;$100&lt;/td&gt;&lt;td class="actions text-right"&gt;
  
                              &lt;button name="submit[1]"  type="submit"  onClick="transferData(this)" class="btn btn-info btn-sm"&gt;&lt;i class="fa fa-refresh"&gt;&lt;/i&gt;&lt;/button&gt;
  
                              &lt;a href="cart_update.php?removep=2015002&amp;return_url=aHR0dC90aXF1ZXNob3AvaW5jbHVkZXMvdmlld19jYXJ0XzIwMTUucGhw" class="btn btn-danger btn-sm"&gt;&lt;i class="fa fa-trash-o"&gt;&lt;/i&gt;&lt;/a&gt;                                                               
                          &lt;/td&gt;&lt;/form&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>But i get an undefined error message and not the id </p>
  
  <p>What am i overlooking??</p>