Jump to content

show div


herghost

Recommended Posts

Well, say you have a div called 'Showme' that's hidden and a button to show it. here's the code so you can use it on many elements wth different id's:

 

<script type='text/javascript'>
function hideShow(div){
if(document.getElementById(div).style.visibility == 'hidden'){
	document.getElementById(div).style.visibility = 'visible';
}else{
	document.getElementById(div).style.visibility = 'hidden';
}
}
</script>


<input type='button' onclick="hideShow('Showme');" />
<div id='Showme' style='visibility:hidden'>I am hidden untill you press the button above. I get hidden again after pressing it another time.</div>

Link to comment
https://forums.phpfreaks.com/topic/237714-show-div/#findComment-1221803
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.