Hi!
I'd like to hide the rows in an HTML table which contain an empty
cell. This has to do with a plugin which generates various tables, so
the user only lists the data as paramaters. The plugin works nicely,
but I'd like to pimp it up. So, beside hiding the row in which a cell
is empty (because the user didn't enter data), I'd also like to hide
the section in which all rows but the subtitle are empty. Also, if no
data has been entered, then a message should be rendered instead of
the table. This is a simplified example where only the Title,
Subtitle1 and test2 line should be visible. Is it as simple as I think
it is or am I going about it the wrong way?
<html>
<script>
if((document.getElementTagName('td').innerHTML === '')) { //If a cell
is empty
document.getElementTagName('tr').style.display = 'none'; //Remove the
line
}
if((document.getElementTagName('tr').length === 1)) { //If only the
subtitle is visible
document.getElementTagName('tbody').style.display = 'none'; //Remove
the section
}
if((document.getElementTagName('tbody').length === 0)) { //If only the
title is visible
document.getElementTagName('table').style.display = 'none'; //Remove
the table
return "<b>No information</b>"; //Display the message instead
}
</script>
<table border="1">
<tr><td colspan="2">Title</td></tr>
<tbody>
<tr><td colspan="2">Subtitle1</td></tr>
<tr><td>test1</td><td></td></tr>
<tr><td>test2</td><td>2222</td></tr>
</tbody>
<tbody>
<tr><td colspan="2">Subtitle2</td></tr>
<tr><td>test3</td><td></td></tr>
<tr><td>test4</td><td></td></tr>
</tbody>
</table>
</html>
Any help would be appreciated.
w
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tiddlywiki?hl=en.