I'm in the process of creating a website that showcases examples of HTML markup, similar to stackoverflow.com. Using .text()
, I am able to display the markup as text and by using .html()
, I can format the text accordingly. My goal is to include a line break with .text()
like this:
$("#affected_text").text("<p>line one</p><br /><p>line two</p>");
and it would appear as:
<p>line 1</p>
//please note the line break
<p>line 2</p>