I have been successful in creating a tooltip for text using code similar to:
<a href="#" rel="tooltip" title="something">text on page</a>
However I would like to do a tooltip for a link defined in a menu using the link_to command. I have included the statement I would like a tooltip to appear for:
<li><i class="icon-edit"></i> <%= link_to current_user.first_name+' '+current_user.last_name, edit_user_path(current_user) %></li>
Here is the JS code in bootstrap.js.coffee:
$(".tooltip").tooltip()
$("a[rel=tooltip]").tooltip()
I am a student still learning a lot about Rails, Twitter Bootstrap, CSS3, HTML5, etc. I have done many web searches but have not found any examples of this that I understood. Basically there is nothing that says directly that I can do a tooltip within a link_to statement that worked.
Any help would be appreciated.
This way:
link_to 'Text', '/link', title: 'some title', rel: 'tooltip'
update:
It's ruby 1.9 syntax. For 1.8 it would be
link_to 'Text', '/link', :title => 'some title', :rel => 'tooltip'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With