Hide row of a table on Web using client side javascript

I am trying to implement hide-when formulas for table rows on the web. I want to use client side javascript, rather than server-side hide-when @formulas.

I’ve discovered the use of id tags to hide elements

document.getElementById(‘idName’).style.visibility=‘hidden’;

This works fine for table cells (using the “cell html tags” attribute of the table) but I can’t work out how to hide a whole row at once. There doesn’t seem to be a way to give a table row an id tag. The “row tags” attribute doesn’t seem to work…

What is the standard way to do this? (I’m new to browser programming) Is the best way to generate the table html yourself, and not use notes tables at all?

Any help appreciated

Subject: Hide row of a table on Web using client side javascript

I may be wrong but I am fairly sure that parentElement property of a cell is the row it is in.

So try

document.getElementById(‘idName’).parentElement.style.visibility=‘hidden’;

Also I recommend using display=‘none’ not visibility=‘hidden’.

I haven’t actually tried this code so I am not 100% sure it will work.

Subject: Brilliant! That works

The parentElement is the row.By the way, when I used ‘visibility=hidden’, it hid all the cells but the row still took up the same space on the screen. I changed to ‘display=none’ and it works perfectly.

Thanks a heap.