# Multiple toggle divs

**URL:** <https://www.ruby-forum.com/t/multiple-toggle-divs/196658>\
**Category:** Rails\
**Created:** [April 28, 2008, 11:40pm UTC](https://www.ruby-forum.com/t/multiple-toggle-divs/196658 "2008-04-28T23:40:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rushnosh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58956e/32.png) [@rushnosh](https://www.ruby-forum.com/u/rushnosh)\
**Post date:** [April 28, 2008, 11:40pm UTC](https://www.ruby-forum.com/t/multiple-toggle-divs/196658/1 "2008-04-28T23:40:43Z")

</div>

i have a list of items i need to display with a corresponding  
paragraph for each item that i want to hid in a div in a view.

\<% @items.each\_with\_index do | item, n | %\>  
\<%= link\_to\_function “highlights”,  
“Element.toggle(‘paragraph#{n}’, ‘true’)” %\>

 some paragaraph. 
\<% end %\>

this is not working because i am not seeing how to get n (index value)  
into the div.  
also there might be an easier way to do this.

i have to have multiple div in my css for this to work

---

<div class="post-metadata">

**Author:** ![rushnosh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/58956e/32.png) [@rushnosh](https://www.ruby-forum.com/u/rushnosh)\
**Post date:** [April 29, 2008, 2:10am UTC](https://www.ruby-forum.com/t/multiple-toggle-divs/196658/2 "2008-04-29T02:10:23Z")

</div>

On Mon, Apr 28, 2008 at 3:40 PM, rushnosh [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> i have a list of items i need to display with a corresponding  
> paragraph for each item that i want to hid in a div in a view.
> 
> \<% @items.each\_with\_index do | item, n | %\>  
> \<%= link\_to\_function “highlights”,  
> “Element.toggle(‘paragraph#{n}’, ‘true’)” %\>

The #{stuff} syntax only works between \<% and %\>  
so replace it there.

>
