In a page, By selecting values I display a table using javascript ajax.
The table looks like this:
S.no    name   S1       S2        S3     S4     S5     Total

1       A     80        90       78      76     100     424
2       B     50        50       50      50     100     350
it goes like this.
My problem  is, I want to calulate total automatically when we type in s5 and display it in total field for each and every row in the table.
How to do? for me first row working  perfectly and displays the total in total field. But remaining, not working
Member Avatar

Is the data coming from PHP? If PHP, then adding a sum item is pretty simple. It can be done on the fly in JS too. Are you creating the whole thing (html table) in PHP and simply getting js to chuck it into the page or are you doing something a little more involved like asking js to process the raw data and place into new dom elements?

for me first row working perfectly and display its sum of total in the first row of total.
But remaining rows values are calculating but displays it in the first row total field only, but not in respective total fields. How to do?

Member Avatar

Are you using jQuery or plain js?

Member Avatar

Any chance that you could show the js you're already using and any HTML? Otherwise we're re-inventing the wheel