title: Add JavaScript String with line breaks and tabs to HTML element
body: <p>I have this HTML:</p>
  
  <pre><code>&lt;p id="element"&gt;Waiting for Message&lt;/p&gt;
  </code></pre>
  
  <p>And this string from the server using <strong>JSON.stringify()</strong> with breaks and tabs in it i.e</p>
  
  <pre><code>var = "Heading (info:info) \n info: \n \t and so on "; // The actual string is more complex though, just an example
  </code></pre>
  
  <p>And this Jquery to post the string to the paragraph tag:</p>
  
  <pre><code>$("#element").text(data); // data is the string from the server(not in JSON!)
  </code></pre>
  
  <p>The problem is the HTML ignores the formatting but when I use an alert box it displays with the proper formatting. I am dynamically updating the element as data comes from the server. Any pointers?</p>