title: Passing Data from Table Rows into an Object Literal with Jquery
body: <p>Here's an example table row from my table:</p>
  
  <pre><code>&lt;tr class="formulaRow"&gt;
      &lt;td&gt;
                &lt;input type="text" class="ingredient required" name="ingredient"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="number" class="amount required" name="amount"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="number" class="carrier required" name="carrier" max="100"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input type="number" class="kilo required" name="kilo"&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;select class="tableDropDown" style="min-width: 100px;"&gt;
                  &lt;option value="other"&gt;The Manufacturer&lt;/option&gt;
                  &lt;option value="me"&gt;Me&lt;/option&gt;
           &lt;/select&gt;
      &lt;/td&gt;
      &lt;td&gt;
          &lt;input class="packSize" type="number" disabled&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;button type="submit" class="analyze"&gt;Analyze&lt;/button&gt;
  </code></pre>
  
  <p>I need to pass this data from each table row into the following javascript function to be further processed once it gets pushed into the "formula" array:</p>
  
  <pre><code>var addIngredient = function(ingredient, active, carrier, price, origin, packSize) {
      var ingredient = {
          ingredient: ingredient,
          active: active,
          carrier: carrier,
          price: price,
          origin: origin,
          packSize: packSize
      };
  
      state.formula.push(ingredient);
  
  };
  </code></pre>
  
  <p>I'm trying to accomplish this task with the following jquery function:</p>
  
  <pre><code>$(".analyze").click(function() {
  var ingredients = $(".formulaRow");
  $("ingredients").each(function() {
      addIngredient($(":input"));
      }
  }
  </code></pre>
  
  <p>However, this is not working.  </p>
  
  <p>It might also be important to note that the addIngredient function is stored on a separate javascript file called data-model.js, whereas the jquery function is stored in a file called interactions.js that both load in the head of the html page.</p>