title: How to write newline using jquery?
body: <p>There is a formatted txt file that my java program reads and sends over the contents as a string to front-end.
  The string that is sent to front end looks like this:</p>
  
  <pre><code>var result = "This is the result.\nIt contains some details\n\nDetails are as follows\nabc,xyz"
  </code></pre>
  
  <p>In the frontend, This data must be written to a div in the following format:</p>
  
  <pre><code>This is the result.
  It contains some details
  
  Details are as follows
  abc,xyz
  </code></pre>
  
  <p>Using the following code did not work:</p>
  
  <pre><code>$("#divId).html(result);
  </code></pre>
  
  <p>Alternates like val(), text() did not work either. 
  How can I make the browser write the new lines in the div when displaying the result?</p>