muthukumar

muthukumar

  • NA
  • 0
  • 101.2k

javascript for total calculation

Sep 3 2014 3:54 AM

here i code a javascript for total calculation but my problem is

on keyup function only one textbox is works i want to both textbox in keyup funtion to calculate
total  (i.e)  quantity and price at runtime i want to edit both to be edit to calculate total



$(function ()
{
$("[id*=grid_productdetails]input[type=text][id*=txt_price]").keyup(function (e)
{

var price = $(this).closest('tr').find("input[type=text][id*=txt_price]").val();

var quantity = $(e.target).closest('tr').find("input[type=text][id*=txt_quantity]").val();

var total = parseInt(price) * parseInt(quantity);

$(e.target).closest('tr').find("[id*=lblTotal]").text(total);


});


Answers (3)