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
https://forums.phpfreaks.com/topic/113398-close-all-open-divs/
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
https://forums.phpfreaks.com/topic/113398-close-all-open-divs/#findComment-582665
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.