0

Tooltipster can take a string as content. For example,

var myHTML = "Hello world";
instance.content(myHTML);

But the content cannot include HTML tags. You can't use this

var myHTML = "Hello <i>world</i>";

although this

var myHTML = "Hello &lt;i&gt;world&lt;/i&gt;";

works.

What is the straightforward way to set a string of tagged HTML as the content of Toolstipster?

JPM
  • 2,029
  • 2
  • 24
  • 27

1 Answers1

0

The problem was not Tooltipster. It was using Toolstipster with XHTML.

var myHTML = "Hello <i>world</i>";
instance.content(myHTML);

works just fine . . . in HTML but not in XHTML, as was being used here.

XHTML parses entities inside <script>. To stop that, wrap the script inside a CDATA:

<script type="text/javascript">
//<![CDATA[

var myHTML = "Hello <i>world</i>";
instance.content(myHTML);

//]]>
</script>
JPM
  • 2,029
  • 2
  • 24
  • 27