# Collapsible Hide/Show DIV

**URL:** <https://www.ruby-forum.com/t/collapsible-hide-show-div/92595>\
**Category:** Rails\
**Created:** [April 21, 2007, 7:33am UTC](https://www.ruby-forum.com/t/collapsible-hide-show-div/92595 "2007-04-21T07:33:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 21, 2007, 7:33am UTC](https://www.ruby-forum.com/t/collapsible-hide-show-div/92595/1 "2007-04-21T07:33:57Z")

</div>

Hi there. I posted this before but wanted to change the subject. I  
want to have a collapsible div inside of a for loop. I’ve been messing  
around with it and could only get 1 item out of a few to be able to  
hide. I’m just using this:

Now, I have for example a major category, with many items in that  
category. What I want to do is, show the category name, but under this  
category, hide the related items. This is done is one loop since I have  
a HASBTM relationship. For example then in pseudo code:

for each cat in cateogry /possible cats are kitchen, living room,  
garage

 div ...etc /div

| Kitchen (show more) |
| knife $3.00 Buy Now | Spatula $5.00 Buy Now |

I want to do something like this. Any help would be nice
