Totalling checked checkboxes amidst changes
<p>I have a page with many checkboxes, each of which are tied to a product with a price. I'm trying to use jQuery to give a real-time readout of the 1) number of products, and 2) total price of the user's selections.</p>

<p>This <em>should</em> be very easy: I would have done something like:</p>

<pre><code>$(input).change( function(){
    var sum = $(input:checked).length
    var price_total = $(input:checked).length * 1.99
})
</code></pre>

<h3>The Complication</h3>

<p>The element or elements <em>being</em> changed are NOT counted in the above code. It seems that when clicking a blank checkbox to check it, jQuery will consider the current element 'not checked' rather than 'checked', i.e. it reflects the checkbox <em>before</em> the change. As a result, my code gets significantly more complicated to accept the changed items.</p>

<p>Is there an elegant and simple way to get around this?</p>
