Gunalah for atau while loop https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for http://www.developertut.com/javascript/javascript-loop-for http://www.developertut.com/javascript/javascript-loop-while
keyup dan keypress $("#diskon").on('keyup keypress', function(e) { var harga = parseInt($("#harga").val()); var diskon = parseInt($("#diskon").val()); var total = harga - (harga*(diskon/100)); $("#totBayar").val(total); }); http://www.developertut.com/