我有一个包含金额的行项目表,用户可以选择或取消选择项目。I have an element on the page that when a change occurs in the selection(s), a total is computed for the selected items.
这是我的函数对值求和的样子。
function ComputeTotalPayment() {
var sum = 0;
$.each($("[id^='payment-amount-']"), function () {
//...compute sum here
});
if ($('amount-total'))
$('#amount-total').text('$' + sum.toFixed(2)); //display
}
当我更改amount-total
(a div)的文本时,有没有办法让数字从旧值淡入新值?