hi frens..

i ll simplify my requirement and explain the issue..

lets say, i have 3 textbox rate, quantity, total and a "add row" button. I must be able to add any no. of rows. There must also be a supertotal field before the "add row" button to display the total of totals. after entering rate and quantity, the total and supertotal should get calculated automatically without refresh.

I am able to add rows successfuly, but total is getting calculated for only 1st row..
here is the code

$(document).ready(function()
{
	$("#rate").change(function()
	{
		
		var rate, qty, total;
		rate = parseFloat($("#rate").val());
		qty = parseFloat($("#quantity").val());
		total = qty*rate;
		if(!isNaN(total))
		{
			$("#total").val(total.toFixed(2));
		}
		else
		{
			$("#total").val("There was a error");
		}
	});
});

how can i get this thing to work for all rows and also calculate the supertotal?
plss help me out with this..

thanks

Recommended Answers

This is javascript. Why are you posting here? Move it to the javascript forum.

Jump to Post

All 3 Replies

Member Avatar

This is javascript. Why are you posting here? Move it to the javascript forum.

aah u r right..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.