I have copy from Comparing form input and span value for keyup function ,
while($row = $results->fetch_array()) {
......
<td><input type="text" name="qtydo[]" value="<?php echo $row['qty'];?>" autocomplete="off" class="form-control" id="one_and_done_stool_QTY_remain" required="" disabled ></td>
<td><input type="text" name="qty[]" value="" autocomplete="off" class="form-control" id="one_and_done_stool_QTY_check" maxlength="7" required=""></td>
}
js
<script>
document.getElementById('one_and_done_stool_QTY_check').addEventListener('input', Qty_check);
function Qty_check(e) {
var QTY1check = +document.getElementById('one_and_done_stool_QTY_check').value;
var QTY1remain = +document.getElementById('one_and_done_stool_QTY_remain').value;
if (QTY1check > QTY1remain) {
console.log("NOPE");
document.getElementById("one_and_done_stool_QTY_check").value = 0;
}
}
</script>
table not working in second row
first row succeeds but second row fails , need help.
thanks