user4133294
user4133294

Reputation:

How to set <a title=""> for erb?

I'm trying to get an erb link to display some text when a mouse is hovered over it. <a title="hover">text</a> works on normal text, but I can't get it to work on a link. Here's what I tried, which does nothing:

<a title="hover"> <%= link_to "All", "all/allthings" %> </a>

Am I going to have to resort to using javascript?

Upvotes: 2

Views: 220

Answers (2)

Alejandro Babio
Alejandro Babio

Reputation: 5229

Try this:

<%= link_to "All", "all/allthings", title: 'hover' %>

More information on: link_to

Upvotes: 5

user3347562
user3347562

Reputation: 29

If you wrap the link in a div tag with the desired title in it you will achieve the result you are looking for!

<div title="hover"><a href="#">link to the place</a></div>

Upvotes: 0

Related Questions