View Full Version : Tables: How to delete younger TDs

07-03-2003, 07:07 AM
I want to walk up the node tree in a set of deeply nested tables from a starting point of interest. Each time I reach a TD element I want to delete any 'next siblings' (TD elements to the right) thus removing any content to the right of my walk.

I think I have to do this from the parent TR element (currNode.parentNode.deleteCell(#)) but I don't know how to determine the index of the current TD to know that # is greater.

Can anyone show me a reference or a code snippet about how to do this?


07-03-2003, 04:40 PM
TD.cellIndex should be what you're after.

Mr J
07-03-2003, 04:40 PM
Take a look here, this may be of some help.


07-03-2003, 05:21 PM
Yowwp! I can't believe I didn't see cellIndex in my book. What a dummy. And the webreference url is a big help, too. Thanks to both of you guys.

I also realized that I could just set currNode.nextSibling.style.display to "none" when the tagName is "TD" and do it that way.

Thanks, again.