Store html code inside data attribute
<p>I need to be able to store formatted HTML inside data attribute later to be picked-up by jQuery in two formats:</p>

<ol>
<li>HTML</li>
<li>Plain text</li>
</ol>

<p>With my PHP I store HTML like this:</p>

<pre><code>echo '&lt;li data-desc="'. htmlspecialchars($myHTMLdescription) .'" class="myTerm"&gt;'. stripslashes($myItem) .'&lt;/li&gt;';
</code></pre>

<p>Later I use JS to get the values:</p>

<pre><code>$(document).on('click', '.myTerm', function() {
    var thisTerm    = $(this).text();
    var description = $(this).attr('data-desc');
    var descNoHTML = description.text();
});
</code></pre>

<p>descNoHTML seems to be breaking code if there are HTML elements like links inside the text.</p>