I have this table which displays values of product name and available stock retrieving from database. I want to insert quantity manually.
The code contains php incremental id's for table row, available stock cell and quantity textbox, such as last_<?php echo $id; ?>
for stock and quanti_<?php echo $id; ?>
for quantity.
I want to compare these two values such as quantity value must be less than or equal to stock value.onclick
of generate bill button we again want to validate for not to submit form if quantity is greater than stock.
$(".edit_td1").click(function()
{
var ID=$(this).attr('id');
//alert(ID);
//$('#quanti_'+ID).blur(function(){
$('.cls_quant').blur(function(){
//var ID=$(this).attr('id');
//var qt=$('#quanti_'+ID).val();
var qt=$(this).val();
var stk=$('#last_'+ID).html();
console.log("Quanty"+qt);
console.log("Stock"+stk);
if (qt>stk)
{
console.log("Quantity > than stock");
return false;
}
else
return true;
});
});