Why are my <br/"> tags being converted to & lt; br / & gt; "?
I have HTML data stored in a database that I want to display as is. He continues to convert tags
at <br /> whose behavior I do not want. I tried playing with javascript replacement, and yet I cannot convert it to plain 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 is displayed in the browser, it has <br /> and therefore there is no line break.
<br /> == <br /> You just need to decode the output to return the original HTML.
Your html data will be "escaped". This prevents the <script> tag from being sent to people who suspect nothing of their browser.
Fix: first you need to determine if your problem is a โbugโ or a โfunctionโ.
Escaping html is usually good. Especially if the only problem is the presentation.
For example, the job might be to insert newlines, not the br element.