1

Like in topic - is there some option to remove action for

link_to

after click on it?

Wordica
  • 2,427
  • 3
  • 31
  • 51

3 Answers3

2

No, you need to do this through Javascript. When the link is clicked you can set a disabled attribute. On subsequent clicks, you can then check for the attribute and if it is set, you can then use e.preventDefault(); to prevent the link from being following.

See: jQuery disable a link

If you're using something like Twitter Bootstrap, there are some more elegant options, via button loading states.

Community
  • 1
  • 1
steakchaser
  • 5,198
  • 1
  • 26
  • 34
  • And to do the click, I think they can use a `:onclick => 'my_javascript_call();'` as a parameter to the `link_to`. – lurker Sep 18 '13 at 16:58
1

Depending on what you're trying to do, you can probably finagle link_to_if and link_to_unless to get achieve what you want.

ohhh
  • 972
  • 9
  • 24
0

Take a look of this, a good explation of this guy:

How to disable HTML links

the right way to do it:

a {
    pointer-events: none;
}
Community
  • 1
  • 1