how to remove class from particular rows using jquery
Hi,
I want to calculate difference and sum of values of text boxes using jquery
following is my code
- $(".toCalculate1").keyup(function () {
var td = $(this).closest('tr').children('td');
var sr = td.eq(1).text();
var total = 0;
$(".toCalculate1").each(function (index, item) {
temp = parseFloat($(item).val());
if (isNaN(temp))
temp = 0;
total = temp - total;
});
$(".total2").val(total * sr);
$(".total1").val(total);
});
following is my table
- <tr><td>1</td><td><asp:Label ID="lb1" runat="server">7</asp:Label></td><td><asp:TextBox ID="t1" Width="35px" CssClass="toCalculate1" runat="server" ></asp:TextBox></td><td><asp:TextBox ID="TextBox1" Width="35px" CssClass="toCalculate1" runat="server" ></asp:TextBox></td><td><asp:TextBox ID="TextBox2" Width="35px" CssClass="total1" runat="server" ></asp:TextBox></td><td><asp:TextBox ID="TextBox9" Width="35px" CssClass="total2" runat="server" ></asp:TextBox></td></tr>
<tr><td>2</td><td><asp:Label ID="Label1" runat="server">8</asp:Label></td><td><asp:TextBox ID="TextBox3" CssClass="toCalculate1" Width="35px" runat="server" ></asp:TextBox></td><td><asp:TextBox ID="TextBox4" CssClass="toCalculate1" Width="35px" runat="server" ></asp:TextBox></td><td><asp:TextBox ID="TextBox5" Width="35px" CssClass="total1" runat="server" ></asp:TextBox></td><td><asp:TextBox ID="TextBox10" Width="35px" CssClass="total2" runat="server" ></asp:TextBox></td></tr>
this code is working fine. get the value of difference in one text box and get the multiplied value in other text box in one row.
the problem is
if i go to second row value of last row also changing
my requirement is in every row i should get different result.
means when i do something with first row ,remove the class(toCalculate) from other rows.
How it is possible
Regards
Baiju