I have a table of the following kind:
<table id="mytable" width="500" border="1" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th><span>1</th><th><span>2</th><th><span>3</th>
</tr>
</thead>
<tbody>
<tr>
<td><span>1/span></td>
<td><span></span></td>
<td><span>2/span></td>
</tr>
<tr>
<td><span>1</span></td>
<td><span></span></td>
<td><span>2</span></td>
</tr>
<tr>
<td><span>1</span></td>
<td><span></span></td>
<td><span>2</span></td>
</tr>
</tbody>
</table>
What I need to do is – hide all the columns of this table where the <span> element contained by the table cell is empty. I will need to hide the cell fully, with the <th> element on the top. In my example above it’s the middle column but there may be a lot of them, not only one.
Could anybody advise over this?
Thanks in advance.
This should work:
Or (simpler):