Forum: Ruby on Rails Can I use link_to_function with html_options somehow?

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.
9cb4de6b61b568a8c13d866ccf3b3433?d=identicon&s=25 DAN (Guest)
on 2007-02-10 02:38
I'm using link_to_function with visual_effect to toggle a list down and
up.

I would like to add { :class => 'mystyle' } to the link_to_function
statement but don't see it accepts html_options based on the API.

Is there a work around of some kind to apply a css class style to a link
created by link_to_function?

Thanks,
DAN
2f9a03aa0fcfe945229cb6126eda2cb2?d=identicon&s=25 Philip Hallstrom (Guest)
on 2007-02-10 04:38
(Received via mailing list)
> I'm using link_to_function with visual_effect to toggle a list down and
> up.
>
> I would like to add { :class => 'mystyle' } to the link_to_function
> statement but don't see it accepts html_options based on the API.
>
> Is there a work around of some kind to apply a css class style to a link
> created by link_to_function?

I think it will...

http://api.rubyonrails.com/classes/ActionView/Help...

link_to_function("Show me more", nil, :id => "more_link") do |page|
.....
   end
     Produces:
       <a href="#" id="more_link" onclick="try {
....

The :id made it through in the right spot, so putting :class right there
should also work I would think.

-philip
9cb4de6b61b568a8c13d866ccf3b3433?d=identicon&s=25 DAN (Guest)
on 2007-02-10 06:14
Thanks - I adjusted my parens and got it working.
DAN
This topic is locked and can not be replied to.