The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Pesky Line breaks… Reply To: Pesky Line breaks…



Thanks for your reply and the code snippet bit. I should have seen that.

If I create a static table in HTML such as the one below, everything is fine.

<td><span class="job_post">Company Overview:</span><br /><?php echo $company_overview; ?><br /><br /></td>

However, if I create a dynamic table via the DOM and import the text, then all goes whacko. I get the line breaks.

var text3 = document.createTextNode('<?php echo $job_description; ?>');

I have tried the nl2br which works fine for the first example, but not for the second. I’ve also tried the following to second example, but with no luck.

$company_overview = str_replace(array("\n","\r"), "", $company_overview);

I hope this helps.