How do I replace all line breaks in a string with <br /> tags?
<p>How can I read the line break from a value with Javascript and replace all the line breaks with <code>br</code> tags?</p>

<p>Example:</p>

<p>A variable passed from PHP as below:</p>

<pre><code>  "This is man.

     Man like dog.
     Man like to drink.

     Man is the king."
</code></pre>

<p>I would like my result to look something like this after the Javascript converts it:</p>

<pre><code>  "This is man&lt;br /&gt;&lt;br /&gt;Man like dog.&lt;br /&gt;Man like to drink.&lt;br /&gt;&lt;br /&gt;Man is the king."
</code></pre>
