I have been trying to hide a form after the submit button is clicked. I have googled and followed some but they seem to be not working for me.
This is my code:
HTML:
<div id="wrapper">
<form name="regForm" id="regForm" action="indexSave.php" method="post">
<table width="100%" border="0">
<tr>
<td colspan="2"> <center> Registration Form </center> </td>
</tr>
<tr>
<td width="23%"> Name</td>
<td width="33%"> <input type="text" name="name" /> </td>
</tr>
<tr>
<td> Email Address</td>
<td> <input type="text" name="email" /></td>
</tr>
<tr>
<td> Contact Number</td>
<td> <input type="text" name="number" /></td>
</tr>
<tr>
<td> Message</td>
<td width="100"> <textarea name="msg"> </textarea> </td>
</tr>
<tr>
<td> <input onclick="myClick()" name="submit" id="submit" type="submit" value="Submit" /> </td>
<td> </td>
</tr>
</table>
</form>
</div>
And my Javascript:
<script type="text/javascript">
function myClick()
{
var me = document.getElementById("wrapper").visibility="false";
}
</script>
I also tried this (from this link )
var me = document.getElementById("regForm").style.display="none";
Please help me figure out what's wrong?
You simply need:
function myClick(){
var form = document.getElementById("regForm");
form.style.display = "none";
}
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With