Read line break in a string with JavaScript
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/784539/replace-all-line-break-in-a-string-with-br-tag-in-javascript">Replace all line break in a string with &lt;br /&gt; tag in javascript</a>  </p>
</blockquote>



<p>How can I read the line break from a value with JavaScript and replace it with a <code>&lt;br /&gt;</code> tag?</p>

<p>Example:</p>

<pre><code>var a = "This is man.
     Man like dog."
</code></pre>

<p>I would like my result to look something like</p>

<pre><code>var a = "This is man.&lt;br /&gt;Man like dog.";
</code></pre>
