Drozzy
Drozzy

Reputation: 71

Table data update on input change

I want to change the table data on input radio change Please check JSFiddle link in the comment with example.

By default, the table show array values for

Plan A ==> cashData, invoiceData and expenseData

But I want to table data to change on input radio plan B click, the table should show

Plan B ==> cashData2, invoiceData2 and expenseData2 and on clicking plan C, table should show total of

Plan C ==> cashData+cashData2, invoiceData+invoiceData2, expenseData+expenseData2 how to change table data on input radio switch?

Upvotes: 1

Views: 173

Answers (1)

Amani Ben Azzouz
Amani Ben Azzouz

Reputation: 2565

You have already the required function to built your table.

Just add the required parameters to your function --> what arrays to use to built the table, and then simply switch the arrays in your change function.

For the last case pass the summ of arrays as parameters, and do not forget to empty your table each time before inserting new html to it. Fiddle

Upvotes: 1

Related Questions