Today, I upgraded all of my jQuery plugs-in with jQuery 1.9.1. And I started to use jQueryUI tooltip with jquery.ui.1.10.2. Everything was good. But when I used HTML tags in the content (in the title
attribute of the element I was applying the tooltip to), I noticed that HTML is not supported.
This is screenshot of my tooltip:
How can I make HTML content work with jQueryUI tooltip in 1.10.2?
add html = true to the tooltip options
Update
it's not relevant for jQuery ui tooltip property - it's true in bootstrap ui tooltip - my bad!
From http://bugs.jqueryui.com/ticket/9019
Try to use javascript to set html tooltips, see below
To expand on @Andrew Whitaker's answer above, you can convert your tooltip to html entities within the title tag so as to avoid putting raw html directly in your attributes:
More often than not, the tooltip is stored in a php variable anyway so you'd only need:
You may modify the source code 'jquery-ui.js' , find this default function for retrieving target element's title attribute content.
change it to
thus whenever you want to display html tips , just add an attribute ignoreHtml='false' on your target html element; like this
<td title="<b>display content</b><br/>other" ignoreHtml='false'>display content</td>
As long as we're using jQuery (> v1.8), we can parse the incoming string with $.parseHTML().
We'll parse the incoming string's attribute for unpleasant things, then convert it back to jQuery-readable HTML. The beauty of this is that by the time it hits the parser the strings are already concatenates, so it doesn't matter if someone is trying to split the script tag into separate strings. If you're stuck using jQuery's tooltips, this appears to be a solid solution.
To avoid placing HTML tags in the title attribute, another solution is to use markdown. For instance, you could use [br] to represent a line break, then perform a simple replace in the content function.
In title attribute:
In your content function: