tags:

views:

66

answers:

2

How can I assign text containing \r\n to an ExtJs textarea and get to see line breaks instead of the actual \r\n characters? When I manually press the Enter key and check Firebug, I can see \r\n getting inserted. But if I assign a string containing \r\n to the textarea, it renders as-is.

Any hints would be helpful.

A: 

Try:

var text = text.replace('\r\n',"" + String.fromCharCode(13) + String.fromCharCode(10));
Lloyd
A: 

I solved it myself. I was using the 'html' property to assign the \r\n-riddled text to the textarea. I changed that to 'value', and it works like a charm. Thanks anyway.

Prakash