I am displaying my query result from a database in an HTML table . The table has many columns and one of them is a checkbox. Depending on the query result, the numbers of records vary. What I want to do is when a checkbox is checked , I want to be able to show a hidden a comment field (td) for that record.
The code below only toggles the td on the first row. Eventhough I click the checkbox on other rows beside the first row, the function only show/hide the
comment td for the first record.
My question is do I need to loop through the table and find out the current row where the checkbox checked? or how can I achieve this.
Any suggestion is greatly appreciated.
I am calling this function on checkbox onclick
function togglevisibility(val, comment)
if (val.checked == true )