Jump to content

Show Hide Div


GoDxNero
 Share

Recommended Posts

Well I am currently using this java script:

function toggle(element) {if (document.getElementById(element).style.display == "none")   {   document.getElementById(element).style.display = "block";   }   else   {   document.getElementById(element).style.display = "none";   }}

How can I make it so that when I start a new function toggle, the previous ones get reset back to invis ? What I mean is that if I got 2+ div ( all vision = invisible ) . Once I click on the first button the first div will appear and when I click the second button the second div will appear together with the first and just like that with the third div and so on... But I want so that once I click the other button it will be the only one that show up and the rest which vision=visible turn back to invisible. Do you guys know a methods work with alots div this way ? Thanks alots in advance !

Edited by Nero
Link to comment
Share on other sites

You could also have a look at the show/hide script here, along with other javascript snippets:http://w3schools.invisionzone.com/index.php?showtopic=9500Shown in practice here:http://www.iribbit.net/i/_files/javascript-snippets.htm

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...