2

I want to write a selector that gets me all the textboxes in a table column. So I can use this with Jquery Calculation to get a 'sum' box. I've written something based off this: Highlighting columns in a table with jQuery

Here's how far I've got: http://jsfiddle.net/Px78h/1/

The page loads, and I see my totals in the totalSum box. But updating any of the textboxes in the column seems to cause it to sum ALL the textboxes.

Am I doing something wrong?

Update: here's the 'end game' of what I was trying to do: http://jsfiddle.net/Px78h/5/

0

2 Answers 2

5

This does not include totalSum input:

$("table. tbody > tr > td:nth-child(1) > input[name!='totalSum']").sum("keyup", "#totalSum");
Sign up to request clarification or add additional context in comments.

Comments

5

You were including the totalSum field in your calcluation. Try

$("table tr > td:nth-child(1) > input:not(#totalSum)").sum("keyup", "#totalSum");

Either that or you make the totalSum not an <input> itself.

http://jsfiddle.net/Px78h/2/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.