Jump to content

Close all open divs?


woolyg

Recommended Posts

Hi,

 

I have a page that is dynamically created, and at any given time there could be any number of DIVs set to display = "block";

 

I need to incorporate a script that, upon clicking a link say, closes all open DIVs. Each DIV is uniquely named.

 

Has anyone ever done something like this before?

 

- WoolyG

Link to comment
Share on other sites

Yes, it's not too bad, but just like creating dynamic links(so that youd have to insert a closing </a> at the end) basically, whatever if statement you use to create the div, you need to use the same to insert the closing </div> wherever it would be inserted, if needed.

 

 

so maybe something like this:

 

if( $open_div == true )
{

open div and do some stuff

}

blah blah whatever else

if( $open_div == true ) 
{

close div and whatever else you might need to do to finish it off

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.