Forum: Ruby on Rails html options in link_to_remote

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eec43f946d65be32e6b9fd2b3a1582a5?d=identicon&s=25 adam.groves (Guest)
on 2005-11-12 12:49
(Received via mailing list)
I'm probably being a bit of a div here but how do I add css class
attributes
to a link_to_remote?
I've got:
 <%= link_to_remote("Add an address",
:url => {:action => 'new_address', :project => @project},
:update =>'partner_div',
:loading => "Element.show('loader')",
:complete => "Element.hide('loader')")
%>
 I've tried sticking in :class => 'myclass' everywhere but to no avail.
Where should I place it?
 Thanks in advance
 Adam
3dd4b52a0946bd698b1d1635a46ea3a3?d=identicon&s=25 francois.beausoleil (Guest)
on 2005-11-12 12:49
(Received via mailing list)
Hi !

2005/11/9, Adam Groves <adam.groves@gmail.com>:
>
> I've tried sticking in :class => 'myclass' everywhere but to no avail. Where
> should I place it?

You have to add another Hash, like this:
<%= link_to_remote("Add an address",
    {:url => {:action => ...}, :update => 'partner_div'},
    {:class => 'myclass', :id => 'test', :title => 'some title'}) %>

That's what the html_options parameter is on
http://api.rubyonrails.com/classes/ActionView/Help...

Hope that helps !
François
This topic is locked and can not be replied to.