I’m trying to print a tooltip with HTML, but I need to espace some of these html. I tried something but without success.
Here is my example: http://jsfiddle.net/wrsantos/q3o1e4ut/1/
In this example I want to escape all html inside of <code>.
<span rel="tooltip"
data-toggle="tooltip"
data-trigger="hover"
data-placement="bottom"
data-html="true"
data-title="<table><tr><td style='color:red;'>complex </td><td>HTML:</td></tr></table><code><html></code>">
hover over me to see html
</span>
Javascript:
$('[rel="tooltip"]').tooltip();
EDIT:
this is not a duplicate for (Can I use complex HTML with Twitter Bootstrap's Tooltip?)
I want something like a “mixed mode” from html and non html tooltip.
In a tooltip I will have stylized content and non stylized content (the non stylized content will be inside a <code> tag).
3
Answers
If you are needing rich media in your tool tip, then I would personally just use JQUERY, HTML Div tags and CSS to build it. Its simple enough and will allow you to create anything you like. Here is an example for you.
This should do it.
EDIT: I misunderstood what you were trying to do. To escape just what’s inside the
<code>
tag, do this:You have to add it in the declaration of the tooltip:
Remove it from the HTML:
FIDDLE: http://jsfiddle.net/q3o1e4ut/7/