use jquery to calculate input

have a look at the sample image

There could ba 2 (or) more rows with input fields.

Now, I want to use JQuery to be able to the following:
If I change one element, it changes the value of other fields.
e.g. for the 1st row if I change the value from 2 to 3, the result should change to 9.
the calculation has to be on a row by row basis.

how do I do it?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David H.H.LeeCommented:
Hi manivineet,
You may try this jQuery plugin called Calculation Plug-in
Andyc75Software ArchitectCommented:
Here is some code I wrote that does what you described in the image

If the value in row 1 changes the total will change in row 1.
if the value in row 2 changes the total will change in row 2

	<script type="text/javascript" src=""></script>
	<script type="text/javascript">
			  var inputA = $('#row1_inputA').val();
			  var inputB = $('#row1_inputB').val();
			  $('#row1_total').val(inputA * inputB);	
			  var inputA = $('#row2_inputA').val();
			  var inputB = $('#row2_inputB').val();
			  $('#row2_total').val(inputA * inputB);	
		<input id="row1_inputA" class="row1" type="text" value="2"/>
		<input id="row1_inputB" class="row1" type="text" value="2"/>
		<input id="row1_total" type="text" value="6"/>
		<input id="row2_inputA" class="row2" type="text" value="3"/>
		<input id="row2_inputB" class="row2" type="text" value="4"/>
		<input id="row2_total" type="text" value="12"/>


Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
manivineetAuthor Commented:
Thanks Andy
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.