Hi,

On Mon, Aug 23, 2010 at 8:38 AM, Pale Horse <[email protected]> wrote:
> I require some information, displayed at the top of a page, to change
> onclick.
>
> The information is in the following form:
>
> <h1>Name<br /><span>Job role</span></h1>
> Description... <%= link_to "read more", :controller => "controller",
> :action => "show", :id => id %>
> <p><span>telephone number</span></p>
>
> There is an image to correspond with this. The image is not a problem; I
> have gotten this image to change on click with 'link_to_function'.
>
> The information above, excluding the image of course, also needs to
> change on click.

If you know at the time of rendering the initial display what
information needs to be displayed when the link is clicked, then you
should probably render both sets of info inside two <div>s: one with
style="display:block" and the other with style="display:none".  Then
your link_to_function can simply toggle the display settings.

If you don't, then I'd recommend using a link_to_remote instead and
hitting the server to remove the first <div> and render the second
using an RJS template.

HTH,
Bill

-- 
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