I have a javascript function which toggle the visibility of a form.
<script type="text/javascript">
function showHide(){
var toggle = document.getElementById('form');
if(toggle.style.display == 'none')
toggle.style.display = 'block';
else
toggle.style.display = 'none';
}
</script>
It is working fine with this link.
<a href="#" onclick="showHide()">Add new:</a>
But when I use this function in this link, it's not working. On clicking this link, page reloaded and hidden content is not displaying.
<a href="products.php?act=edit&id=1" onclick="showHide()">Edit</a>
Here is demo: products.php
I want same working of both "Add new:" & "Edit" links to show or hide the form with out reloading the page.