Reputation: 7941
I'm trying to include an image in my Tooltip:
My Link:
<%= link_to "#", class: "tag-tooltip",
'data-placement' => 'right',
:rel => "tooltip" %>
My Js(coffee):
$(document).on "ready page:change", ->
$(document).ready ->
$(".tag-tooltip").tooltip({ title: "whatsup", content: "<img src=\"http://icdn.pro/images/fr/a/v/avatar-barbe-brun-homme-utilisateur-icone-9665-128.png\" />", html: true})
But only the Text is appearing.. What am i Missing ?
Upvotes: 0
Views: 724
Reputation: 38645
Use template
in place of content
like follows:
$(document).on "ready page:change", ->
$(document).ready ->
$(".tag-tooltip").tooltip({ title: "whatsup", template: "<img src=\"http://icdn.pro/images/fr/a/v/avatar-barbe-brun-homme-utilisateur-icone-9665-128.png\" />", html: true})
Update:
Based on the gem code, it appears that the content of the tooltip is actually the title
. So you could also do:
$(document).on "ready page:change", ->
$(document).ready ->
$(".tag-tooltip").tooltip({ title: "<img src=\"http://icdn.pro/images/fr/a/v/avatar-barbe-brun-homme-utilisateur-icone-9665-128.png\" />", html: true})
Upvotes: 2