On Apr 8, 5:45 am, esdevs <[email protected]> wrote:
> ok - I am trying to do something seemingly straight forward.
> Essentially I want to list out a bunch of items and for each item
> individually, if the user clicks on it, the corresponding web link
> will appear underneath -- if the user clicks on the item again, then
> the weblink disappears.  This should work for each item in the list.
> I have tried but to no avail - below is a vid clip of what is
> happening as well as the code that I am using -- any help is greatly
> appreciated
>
Well by the looks of things you have multiple divs with the same id
(never a good) idea, you're using link_to_remote but not actually
making an ajax call (link_to_function might be more appropriate) and
if my memory is correct and you want to select that link, next()
selects siblings whereas it looks like you want to select children
(which is what down does)

Fred

> http://www.screentoaster.com/watch/stU0… BeQlVeXV5e
>
> (partial _post.html.erb)
> <h2><%= link_to_remote("#{post.title}", :after => "$('link').next
> (1).toggle()") %></h2>
> <div id="link" style="display: none;">
>   <%= post.link %>
> </div>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to