title: How do I use jquery to total fields in rows for a variable number of rows
body: <p>I am trying to add the option fields on a row to the total field on the row, using jquery. I can't use ids because there are a variable number of rows, that get created with clone as the user needs them.</p>
  
  <pre><code>&lt;tr&gt;
  &lt;td&gt;&lt;input name="option_1[]" type="text" class="integer add_to_total"  /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input name="option_2[]" type="text" class="numeric add_to_total"/&gt; &lt;/td&gt;
  &lt;td&gt;&lt;input name="option_3[]" type="text" class="numeric add_to_total"/&gt; &lt;/td&gt;
  &lt;td&gt;&lt;input name="total[]" type="text"   class="numeric is_total"  /&gt; &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I thought of attaching a change event to the input fields with the 'add_to_total' class and using the sibling function to add to the 'is_total' class.  but I can't get that syntax right:</p>
  
  <pre><code>$(".add_to_total").change(function() {
      var line_total = 0;
      line_total += $(this + " .add_to_total").siblings().val();
      $(this +  " .is_total").siblings().val(line_total);
  });
  
  I get syntax errors and it doesn't work.
  </code></pre>