'html 2 input if 1st input value 0 then show 2nd input value "PAID" if 1st input value not 0 then 2nd input show "NOT PAID"

html 2 input if 1st input value 0 then show 2nd input value "PAID" if 1st input value not 0 then 2nd input show "NOT PAID"

              <label>Balance Amount</label>
//1st input   <input type="text"  name="balance_amount"><br><br>
              <label >Amount Status</label>
//2nd input   <input type="text" name="status"><br><br>

//result

if 1st input have any number (means not paid) like 1, 100, except 0 valve show in 2nd input show result NOT PAID, other wise show PAID



Solution 1:[1]

I have made a very simple idea of how to do it, I have added a click option with an event handler and it checks to see if the value is 0 and then if it is not then enter UNPAID into the status.

$(".click").click(function() {
var inputVal = $('#balance').val();

if (inputVal === '0') {
$('#status').val("PAID");
} else {
$('#status').val("UNPAID");
}

});
<script src="https://code.jquery.com/jquery.js"></script>
<label>Balance Amount</label>
<input type="text" id="balance" name="balance_amount"><br><br>
<label >Amount Status</label>
<input type="text" id="status" name="status"><br><br>

<div class="click">click</div>

To do it without clicking the enter key, change the JS code to :

$('#balance').keyup(function(e){
var inputVal = $('#balance').val();
if (inputVal === '0') {
$('#status').val("PAID");
} else {
$('#status').val("UNPAID");
}
});

It checks every time a key is pressed and if the amount value is '0' then its 'PAID' Anything else will be 'UNPAID' You should add max and numeric only input also. Its pretty basic but should show you where to start.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1