I have strings of HTML formatted text in a database, e.g:
<div><p>example</p></div>
And I'm adding them to fields in a table. The table html is created in a string and appended to a div with jQuery like this:
var str = '<table><thead><tr><th>Heading</th></tr></thead><tbody>';
str += '<tr><td>';
str += database[index].fieldWithHtml;
str += '</td></tr></tbody></table>';
$("#myElement").append(str);
Currently the text that shows in the cell is formatted and shows just 'example'. What I want is for it to not actually use the html tags to format the text, but rather to show them, e.g. the example output would be the same:
<div><p>example</p></div>