Using jQuery to add up values and then fire a result
<p>I'm attempting to take the different values in a list, add them up and if the values are greater than 150, a class is added to a specified div.  Here's the HTML I'm working with:</p>

<pre><code>&lt;ul class="fc_cart_item_options"&gt;
&lt;li class="fc_cart_item_option fc_cart_item_weight"&gt;Weight: 70 &lt;span class="fc_uom_weight"&gt;LBS&lt;/span&gt;&lt;/li&gt;
&lt;li class="fc_cart_item_option fc_cart_item_weight"&gt;Weight: 81 &lt;span class="fc_uom_weight"&gt;LBS&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>What I'm trying to figure out is how, using jQuery, do I add up the values of these different list items shown above, and when they're greater than 150 to then add a class to a specific div?  There may be instances where I only have one list item that has a weight great than 150 whereas in some cases I may have 20 list items that add up to greater than 150 and therefore need the same outcome which is to add a class to a specific div.</p>

<p>My goal is that if the above list item's values is ever greater than 150, the div with the class of "gt_150" will get the class of "foo" added on.  Hope that makes sense.</p>

<p>======</p>

<p>Edit:</p>

<p>Just ran into a small problem after getting some great answers from others (thanks again so much everyone for your immediate responses).</p>

<p>One thing I didn't take into account is quantity.  Here's what I mean: a list item may be 70 pounds, but may have a quantity of 3 (210 pounds) which pushes it over the weight limit.  The problem is with the current solution, this doesn't take into account quantity of a given list item.  This solution (first response provided below) works great, but I forgot to factor the following.</p>

<pre><code>&lt;table&gt;
&lt;tr class="fc_cart_item"&gt;
&lt;td&gt;
    &lt;ul class="fc_cart_item_options"&gt;
    &lt;li class="fc_cart_item_option fc_cart_item_weight"&gt;
    Weight: 70 &lt;span class="fc_uom_weight"&gt;LBS&lt;/span&gt;
    &lt;/li&gt;
    &lt;/ul&gt;
&lt;/td&gt;
&lt;td class="fc_cart_item_quantity"&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>In this HTML above, a list item may only be 70 pounds by itself (which doesn't cause the jQuery to add the class "foo" to the specific div), but if the quantity is 3, I need to factor that in.</p>

<p>In all cases with the list item, the next cell with the quantity will follow right after it.</p>
