I have HTML data stored in database which I wish to display as is. It keeps converting
tags to <br /> which is a behavior I do not want. I have tried playing with javascript replace and still I am unable to convert it to regular HTML.
var venueaddress = msg.result[0].venueaddress;
var venueaddress2 = venueaddress.replace("[newline]", "<br />");
alert(venueaddress2); //shows <br />
$("#venueaddress").text(venueaddress2); //lets now display it on the browser
<li><h3>Venue Address</h3><p><strong> <span id="venueaddress"></span> </strong></p></li>
However when it renders on browser, it has the <br /> and there fore there is no line break.
Your problem is with
you should use
Text will encode any html character and will display it in span as encoded, html will not.