I need to render html content as html, but it is rendering as string text.
$('#description').html($.parseHTML('<%=event.description%>'));
jQuery add the text as string, it is not rendering the HTML tags, if blog.description
contains paragraph, bold, italic and other HTML elements it renders in pure text.
Description content is not stored as escaped HTML, is just in pure HTML.
Thanks in advance
## EDIT ##
I'm not using .NET Framework, just Node.JS with Express and EJS template engine.
I store the description field in DB as both methods:
:: Decoded:
"<p> example <b>text</b> </p>"
:: Undecoded:
"<p> example <b>text</b> </p>"
Unfortunately both ways don't make the text to be correctly displayed as HTML into signed div.
I resorted to jQuery because the first attempt to load the text directly from DB didn't work.
I've tried:
$('#description').html( MY TEXT ).text();
$('#description').text( MY TEXT ).html();
$('#description').html( $.parseHTML(MY TEXT) );
Doesn't work. However if I get the description text and copy and make it render by myself (avoiding DB) it displays correctly.
The picture shows what is going on:
Any extra tip will be helpful.