sum values from inputs and selects in form
Hi i was looking for a script in jquery to sum values from inputs and
select options and i found this script:
SOURCE: Jquery checkbox and select - sum the values and add in var
DEMO: http://jsfiddle.net/H4d7W/
The only problem is that my form contains multiple inputs and multiple
selects.
I was thinking something like this:
REPLACE:
tot+=parseInt($('#more').val());
$('#usertotal').html(tot)
});
$('#more').change(function(){
$('input:checkbox').trigger('change');
});
FOR:
tot+=parseInt($('select > option:selected'').val());
$('#usertotal').html(tot)
});
$('select > option:selected'').change(function(){
$('input:checkbox').trigger('change');
});
Any idea of how can i edit that code to accomplish this.
No comments:
Post a Comment