I have a link on the index.html.erb page. Its a download link. Now I want that if the cursor hovers on the link then a tooltip text will be displayed.e I have tried several combinations but did not get the solution yet.
My code is here:
<p>
Download:
<%= link_to "CSV", users_export_path(format: "csv") %> |
<%= link_to "Excel",users_export_path(format: "xls") %>
</p>
I installed bootstrap and I want to generate bootstrap tooltip for this two links. Please tell what should I do along with right syntax.
You can set the necessary data attributes in the 'link_to' helper:
<%= link_to "CSV", users_export_path(format: "csv"), title: 'Download CSV', 'data-toggle' => 'tooltip', 'data-placement' => 'right'%> |
<%= link_to "Excel", users_export_path(format: "xls"), title: 'Download Excel', 'data-toggle' => 'tooltip', 'data-placement' => 'right'%>
then add the following js
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});