Hello everyone. I am trying to display rows depending upon users choice. Suppose (s)he wants only 3 rows, then the fourth and fifth row will hide. Please find below the part of html and javascript.
HTML
<table>
<tr id="sRow1">
<td>1a</td>
<td>1b</td>
</tr>
<tr id="sRow2">
<td>2a</td>
<td>2b</td>
</tr>
<tr id="sRow3">
<td>3a</td>
<td>3b</td>
</tr>
<tr id="sRow4">
<td>4a</td>
<td>4b</td>
</tr>
<tr id="sRow5">
<td>5a</td>
<td>5b</td>
</tr>
</table>
JavaScript
// b gets value from xml file
while (b <= 5)
{
var rowName = "sRow" + b;
alert(rowName);
try {
document.getElementById(rowName).style.display = "none";
}
catch (err)
{
alert(err.description)
}
b++;
}
I am getting Object required error at document.getElementById(rowName).style.display = "none";. Can you please help.