| re: Expand/collapse blocks of divs in a page
sam wrote:[color=blue]
> Hi all,
>
> I have a series of divs in 2 blocks say BLOCK1 and BLOCK2 and I want to
> use one click to expand/collapse all those in each block. But the code
> I came up with exapands all the divs in the entire page. How do I
> restrict it to each block and also how do I cllapse those in each block
> and change the text to Collapse All. I am stumped here.
> Any help really really appreciated. Here is my code.[/color]
Why not just do one of the following:
Use a naming convention, so that each block, and the subdivs can be
determined, so block a may have an id: blocka, and then just append a
number for each subdiv, so you have blocka1, blocka2, ..., blockan
Then, you can just open and close them as needed.
Or, if each div is the immediate child of the block div, then just get
all the childnodes for the block div, and open/close those. |