Rails: using link_to to make a link without href

后端 未结 8 1843
情书的邮戳
情书的邮戳 2020-12-29 19:05

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

8条回答
  •  甜味超标
    2020-12-29 19:25

    I use this approach:

    = link_to('Click me', 'javascript:;', :id => :foo)
    

    Its basically a Javascript no-op

提交回复
热议问题