I thought it was more on the lines of $(".total").val(tot) considering he
said the input had the class "total".
Michel Belleville
2009/11/13 Dan G. Switzer, II
> palgo:
>
> You probably mean:
>
> $("#total").val(tot);
>
> The selector $("total") would be looking for an element named total (i.e
palgo:
You probably mean:
$("#total").val(tot);
The selector $("total") would be looking for an element named total (i.e.
,) where as $("#total") looks for an element with an id of "total".
-Dan
On Fri, Nov 13, 2009 at 10:13 AM, palgo wrote:
> Hi guys,
>
> I have several input fields where t
While is a bad habit you may love to leave when you try the iterator
approach :
var tot = 0;
$('.part').each(function() { tot += $(this).val(); });
$('.total').val(tot);
And don't forget classes are accessed with a '.' (total lacked it's '.' in
your example).
Michel Belleville
2009/11/13 palgo
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
v
4 matches
Mail list logo