$(document).on('blur', '#transAmt', function () { calculatAmt(rate_t0, counter_fee_t0); var transAmt = $('#transAmt').val(); storage.setItem('transAmt', transAmt); });
變成如下,經過定時器來變化code
$('#transAmt').on('input',function(){ setInterval(function(){ calculatAmt(rate_t0, counter_fee_t0); var transAmt = $('#transAmt').val(); storage.setItem('transAmt', transAmt); },300); });