Hey all, I have several divs like this: <div class="collapseme" style="display:none" >blabal</div> <div class="collapseme" style="display:none">blabal</div> <div class="collapseme" style="display:none">blabal</div> I would like to do a link_to_function or link_to_remote to make them visible all by one click. Any idea how to do that? thanx in advance Pat --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Patrick Aljord napisaĆ(a):> Hey all, > I have several divs like this: > <div class="collapseme" style="display:none" >blabal</div> > <div class="collapseme" style="display:none">blabal</div> > <div class="collapseme" style="display:none">blabal</div> > > I would like to do a link_to_function or link_to_remote to make them > visible all by one click. > > Any idea how to do that?You can do this with ''link_to_remote'' with the request to e.g. ''change'' action. But instead of ''change.rhtml'' use ''change.rjs'' template. Inside this template you can use e.g. ''page.show'' for as many divs as you wish. You should give your divs ''id'' parameter to reference them in ''page.show'' methods. -- RaW --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Elad Meidar - Creopolis.com
2007-Jan-14 09:00 UTC
Re: how to toggle several divs at the click?
RJS Is not a must, you can use a JS onclick event. link_to ''Open Divs'', "#", {:onclick => ''Element.toggle(''div1_id''); Element.toggle(''div2_id'');} --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Patrick Aljord wrote:> Hey all, > I have several divs like this: > <div class="collapseme" style="display:none" >blabal</div> > <div class="collapseme" style="display:none">blabal</div> > <div class="collapseme" style="display:none">blabal</div> > > I would like to do a link_to_function or link_to_remote to make them > visible all by one click. > > Any idea how to do that? > > thanx in advance > > PatUse RJS. myaction.rjs page.select(''div.collapseme'').each { |item| item.hide } A. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---