how to collapse all with a toggle

Hey all,

I have a loop that kind of looks like this:

<% for item in @items %>
<span id='showbox_<% item_id%>' style="display:none" ><% item.id %></span>
<%= link_to_remote 'show other ids', :url=>{:action=>showall} %><br>
<%end%>

What I want to do is when "show other ids" is clicked, the content of
each span is showed (eg. with a toggle) except for the span that goes
with the link that's been clicked.
any idea how to do this?

Thanx in advance

Pat

Patrick Aljord wrote:

I have a loop that kind of looks like this:

<% for item in @items %>
<span id='showbox_<% item_id%>' style="display:none" ><% item.id %></span>
<%= link_to_remote 'show other ids', :url=>{:action=>showall} %><br>
<%end%>

What I want to do is when "show other ids" is clicked, the content of
each span is showed (eg. with a toggle) except for the span that goes
with the link that's been clicked.
any idea how to do this?

In the end, the answer will be a combination of RJS and CSS. In terms of what exactly that needs to look like, I'm not grokking what you want it to look like initially. Right now what you have above will show a bunch of rows where each row is a link that says 'show other ids'. And that's all. More info needed to assist.

Best regards,
Bill

what is display is:
(item.id) 'show other ids'
with item.id being hidden.

let's say I have:
(1) 'show other ids'
(2) 'show other ids'
(3) 'show other ids'

now if I click on the second 'show other ids', then it will change the rows to:
1 'show other ids'
(2) 'show other ids'
3 'show other ids'

with 1 and 3 visible and 2 still hidden. See what I mean?

thanx in advance

Pat