Rolf,

>That's a nice little plugin Dan! Is it possible to sum a column of text
>inputs as they're filled (self-totalling, rather than onClick)?

Sure! You'd just need to trigger sum() event to occur on a keypress event.
If you're going to do that, I'd definitely recommend caching the jQuery
object you're going to perform the sum() on (that way you're not spending
cycles always looking up which elements to sum().)

One neat feature is that you can mix and match element types with the
mathematical functions. So you can sum a text element against a div element.

I just realized the description text on the page is completely wrong! It's
for another plug-in and I used that page as a template for this one. :)

-Dan

>
>
>Dan G. Switzer, II wrote:
>>
>>
>> It sounds as if this might be a good candidate for my Calculation plug-
>in:
>> http://www.pengoworks.com/workshop/jquery/calculation.plugin.htm
>>
>> $("tr").each(function (){
>>      var sum = $("span.length", this).sum();
>>      var person = $("td.person").text();
>>
>>      alert(person + " = " + sum);
>> });
>>
>> -Dan
>>
>>
>
>--
>View this message in context: http://www.nabble.com/sum-of-table-rows-
>tp14879031s27240p15050352.html
>Sent from the jQuery General Discussion mailing list archive at Nabble.com.


Reply via email to