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

« help!!! || onChange this.form.submit »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home