Skip to content
Advertisement

Show checkbox checked in the table

I have a problem showing the selected check value in the table. Now I cannot follow my selected value to show the check values in each row in the table.

For example below coding,I have the selected values following are true,false,true,false,true,false, I need to show these values in the checkbox, so I make these value to become checked or uncheck, if value is true then will checked, else will uncheck:

JavaScript

This is my working online editor: https://paiza.io/projects/D-J1uBPeHJuL8jCOhToRQQ

I want the expected result like below the picture, the selected values can follow by true,false,true,false,true,falsein each row in the table:

output1

Hope someone can guide me on how to solve this problem. Thanks.

Advertisement

Answer

In your code there is $tick value every time the same, for all checkboxes.

If you have tick values in array, than it’s quite easy. In each row check $myArray[X] value.

JavaScript

You can do it in loop, than code would be st. like (expected you have contact&country in any array too)

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement