Hi guys,

I have several input fields where the value get set (gave them class
name ="part").
I want to sum up the input values into a last input field with class =
"total", whenever something is being typed in some other fields.

The input fields with class "part" is not a fixed amount, they can
vary between 2 to infinite.

So I tried this, which doesn't work:

$(".whatever").live("keyup", function(event){

                var arr = $(".part");
                var len = arr.length;
                var tot = 0;

                while (i<len)
                {

                    tot = tot +arr[i].val();
                    i--;
                }

$("total").val(tot);

        });

Anyone know what I'm doing wrong?


Reply via email to