Click here to Skip to main content
15,902,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai I am using three text boxes Item, Price, and Quantity, and one label stock , the stock are binding the value from the database. Now I need for the User never enter the value for Quantity more than Stock, below is my jquery can anyone Please tell me where I want change the Code in jquery .Below code is working fine .


C#
$(function () {
            $("[id*=txtQuantity]").val("0");
        });
        $("[id*=txtQuantity]").live("change", function () {
            if (isNaN(parseInt($(this).val()))) {
                $(this).val('0');
            } else {
                $(this).val(parseInt($(this).val()).toString());
            }
        });
        $("[id*=txtQuantity]").live("keyup", function () {
            if (!jQuery.trim($(this).val()) == '') {
                if (!isNaN(parseFloat($(this).val()))) {
                    var row = $(this).closest("tr");
                    $("[id*=lblTotal]", row).html(parseFloat($(".price", row).html()) * parseFloat($(this).val()));
                }
            } else {
                $(this).val('');
            }
            var grandTotal = 0;
            $("[id*=lblTotal]").each(function () {
                grandTotal = grandTotal + parseFloat($(this).html());
            });
      $("[id*=lblGrandTotal]").html(grandTotal.toString());
        });
Posted
Updated 7-Sep-13 0:03am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900