I have four three textboxes, one Label and an input button.
In first textbox I add the function name and second and third textboxes enter the numbers which give me the multiplication of two textboxes on key up and answer in Textbox3. After a add button the value Textbox3 show in label and then all textboxes should be empty except label which show grand total now I want to do another entry in textboxes and give answer in Textbox3 now I want to shows grand totoal in label is the sum of previous and current result but it show latest result show in the label like following example.
Textbox1 Textbox2 Textbox3 Textbox4 Grandtotal
multiple 5 6 30 30
New Multiply 6 7 42 42
But in Grnadtotal show the total means show 72 instead of 30 following my code.
Multiple function….
$(function () {
$(".toCalculate").change(function () {
// $(".toCalculate").keyup(function () {
var total = 1;
$(".toCalculate").each(function (index, item) {
temp = parseFloat($(item).val());
if (isNaN(temp)) {
if ($('[id*= Textbox2]').val() == '' && $('[id*=Textbox3]').val() == '') {
temp = 0;
} else {
temp = 1
}
}
total = total * temp;
});
$(".total").val(total);
});
});
Jquery Function which Show the grand total
function GetRow() {
var function = $("[id*=Textbox1]").val();
var value1 = $("[id*= Textbox2]").val();
var value2= $("[id*= Textbox3]").val();
var result = $("[id*= Textbox1]").val();
if (function != "" && value1 != "" && value2 != "" && result != "") {
var grandtotal = $("[id*=result]").val();
var grandtotal = grandtotal + result;
grandtotal = result;
Label29.innerHTML = grandtotal;
}
$("[id*=function]").val('');
$("[id*= value1]").val('');
$("[id*= value2]").val('');
$("[id*= result]").val('');
return false;
};
Everything is ok but I can’t find the grand total please help me to solve that thanks in advance.