I have two textboxes (Qty, Empties) as shown below. I would like to remove the disabled attribute if the Qty text box has a value. How do I do this with JS?
<input type="number" class="form-control" name="qtyEmpty[]"
disabled id="<?php echo "qtyEmpty" . $b++; ?>"
min="1" max="<?php echo $case_true_quantity; ?>" />
I believe this should solve your problem
HTML:
<input type="text" name="sPriceRewards" id="sPriceRewards" value="" />
<input type="text" name="sReward1" value="" class="inputReward" />
JS code:
$('#sPriceRewards').on('input', function() {
if($(this).val().length)
$('.inputReward').prop('disabled', true);
else
$('.inputReward').prop('disabled', false);
});