Hi,
I am trying to hide a table based on its id on clicking a button.
function showTable() {
var reasonTable = document.getElementById("reasonTable");
if(reasonTable.style.display == "none")
{
reasonTable.style.display = "block";
reasonTable.style.visibility = "visible";
}
}
<form id="MyForm" method="post" name="MyForm">
<TABLE id="reasonTable" style="visibility: hidden; display: none;" WIDTH="612" CELLPADDING="0" CELLSPACING="0" ALIGN="center">
<TR>
<TD VALIGN="middle" HEIGHT="15">Value1</TD>
</TR>
<TR>
<td>
<a href="#" onclick="javascript:showTable();">submit</a>
</td>
</TR>
</table>
</form>
It is giveing null
for document.getElementById("reasonTable")
. Whats wrong in above code. Thanks in advance.