$(document).on("input", "#payedValue", function () { var mad = $("#madyoniya").val(); var payed = $(this).val(); $("#rest").val(parseFloat(mad) - parseFloat(payed)); });