如何将文本框值与表格单元格值进行比较

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;

    });
});

I suggest you add parseInt() fucntion to your vars like that:

var qt = parseInt($(this).val());
var stk= parseInt($('#last_'+ID).html());

I hope this helps

If the value displayed correctly just parsed into number like so :

var qt   =  +$(this).val();
var stk  =  +$('#last_'+ID).html();