simple hide function is not working as intended
Hi all,
First of aal sorry for my ignorance, but i just started with javascript.
I made small function with that hides or shos a div. In addition to that i made a small button that class that function.
Maybe someone could take a look at it and point me in the right direction:
this i put in my <head> </head>
Code:
<script type="text/javascript">
function hide_me(haha){
var el = document.getElementById(haha)
if (el.style.display != 'none'){
el.style.display = 'none';
}else{
el.style.display = '';
}
}
</script>
and in the body i have this
Code:
<div id="haha">
<p>moehaha i am invisible</p>
</div>
<input type="submit" onclick="hide_me(haha)" value="press me" />