i have 3 input like this
Grand Total Box
<input type="text" name="GrandTotal" id="GrandTotal" class=" form-control" placeholder="Grand Total" required />
Down Payment
<input type="text" name="DownPayment" id="downpayment" class=" form-control" placeholder="Down Payment" required />
Status Box
<input type="text" name="Status" id="status" class="form-control" placeholder="Status">
So the Grand Total input is automatically filled using javascript, example GrandTotal is 2500, then i had to fill the downpayment box, when i input downpayment like 3000, the status must say PAID OFF. but when we fill the downpayment like 2000 status must say MINUS 500
but the reality is when i write the downpayment just number 5 it say PAID OFF and didnt change even i put more than the grandtotal's value. but when i delete the value it say undefined
here's my script
$('#downpayment').on('keyup keydown', function (
var $this = $(this),
GrandTotal = $("#GrandTotal").val(),
downpayment = $("#downpayment").val();
var value = GrandTotal - downpayment;
if (GrandTotal < downpaymentval) {
var status = "PAID OFF";
$('#status').val(status);
} else {
var status = "MINUS".value;
$('#status').val(status);
}
console.log(status);
});
Thanks, now it solved, thankyou for answering