Below is my function for checking and preventing to input a value greater than the available quantity. It is triggered by onBlur.
Suppose: intData = 7 intOnHand = 46
When it reaches if(intData > intOnHand) it enters the code. Which supposedly it should not. Because 7 > 46 is false. Weirdly enough this happen only when input data is between 5-9. And greater than 46(which is correct).
Output of my alert:
intData7
inOnHand46
Qty to Borrow Must not greater than the qty on the inventory!
function CheckInput(intData){
var mode = $('#mode').val();
intOnHand = $('#qtyin').html();
if(mode == 'Borrow'){
if(intData > intOnHand){
alert("intData"+intData);
alert("inOnHand"+intOnHand);
alert("Qty to Borrow Must not greater than the qty on the inventory!");
$("#QtyToReturn").val(intOnHand);
}
}
}