detecting line breaks
Date: 08/04/06
(Javascript Community) Keywords: html, java
I'm sure there has to be a simple answer to this one...
I've got a text area full of text that the user has entered.
I've also got a div that I'm writing information to.
When my JavaScript lifts the text out of the text area and dumps it in the div, it looses its line breaks because (obviously) it's not formatted html.
So here's my question - how do I detect those line breaks and replace them with br tags? My experiments with x.replace-ing \n or \r\n all seem to fail.
Source: http://community.livejournal.com/javascript/108711.html