我有一个表单,其中的字段会在添加值时自动合计,它在6,7 +8和FF中工作正常但在Safari和Chrome中该字段是空白的 - 任何想法?
// total income
jQuery(document).ready(function(){
jQuery("input.add").change(function () {
var sum = 0;
jQuery('.add').each(function() {
var Total = sum += Number(jQuery(this).val());
jQuery("#input_38").val(Total);
});
}); <--- Chrome has a problem with this 'Unexpected token ILLEGAL'
// total expenditure
jQuery("input.add_ex").change(function () {
var sumEx = 0;
jQuery('.add_ex').each(function() {
var TotalEx = sumEx += Number(jQuery(this).val());
jQuery("#input_70").val(TotalEx);
});
});
//grand total
jQuery("input.add_ex").change(function () { // when total expenditure field changes
var totalInc = Number(jQuery("#input_38").val()); // store total income as var
var totalExp = Number(jQuery("#input_70").val()); // store total expenditure as var
jQuery("#input_75").val(totalInc - totalExp); // change grand total
});
});//end