0

I just want to create a link that does nothing when it is clicked (other than the jQuery code I am binding to the link's ID.

I am returning "false" in my Javascript function that is bound to the links, but I would just like the link to be "#" or something like that. When I try this:

link_to("Link", "#here")

That gives me the entire current url, plus "#here" stuck on the end.

RubyRedGrapefruit
  • 12,066
  • 16
  • 92
  • 193

3 Answers3

3

try this

<%= link_to "TEXT" %>
Rodrigo Zurek
  • 4,555
  • 7
  • 33
  • 45
2

Try this: <%= link_to('#', :id => 'link_id', :class => 'some_class') %>

Edit

Sorry, I just now saw that this question pertains to Rails 2.3.11. I looked at the api and it looks like it may still work, but if it doesn't, let me know and I'll remove this answer.

Zajn
  • 4,078
  • 24
  • 39
2

You can try something like this

<%= "Link", "javascript:void(0)" %>
Pritesh Jain
  • 9,106
  • 4
  • 37
  • 51