Forum: Ruby on Rails javascript in link_to?

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.
Ac31d0d6453b50ad6fdfe16742273424?d=identicon&s=25 John McGrath (Guest)
on 2006-01-26 21:29
(Received via mailing list)
having trouble finding how to include a random chunk of javascript (an
onclick event handler) in a link_to generated link.

at first i thought i could use the html_options field, but if i
understand
correctly, that only supports :confirm, :popup, and :post options.

hope i'm wrong. anyone know different?

john
C8a634a01a2c4508360874bff7fb1a7f?d=identicon&s=25 Kevin Olbrich (olbrich)
on 2006-01-26 21:48
John McGrath wrote:
> having trouble finding how to include a random chunk of javascript (an
> onclick event handler) in a link_to generated link.
>
> at first i thought i could use the html_options field, but if i
> understand
> correctly, that only supports :confirm, :popup, and :post options.
>
> hope i'm wrong. anyone know different?
>
> john

pretty much anything you put in the html options will show up in the
html, except for those few exceptions.  Just put "onclick"=>"random
code" in and try it.

_Kevin
Ac31d0d6453b50ad6fdfe16742273424?d=identicon&s=25 John McGrath (Guest)
on 2006-01-26 21:59
(Received via mailing list)
worked, thanks much.
This topic is locked and can not be replied to.