How can I use the link_to helper to make a link without an href attribute? I want to make a link exclusively for a javascript action, I don't want it reloading the page or anything.
link_to
href
When I omit the url parameter, clicking the link reloads the page. Ditto for providing nil in place of the url.
nil
I use this approach:
= link_to('Click me', 'javascript:;', :id => :foo)
Its basically a Javascript no-op
no-op
2.1m questions
2.1m answers
60 comments
57.0k users