Reputation: 12214
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.
Upvotes: 0
Views: 2484
Reputation: 9146
You can try something like this
<%= "Link", "javascript:void(0)" %>
Upvotes: 2
Reputation: 4088
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.
Upvotes: 2