Entry
how can i write a string variable to an existing textarea....and maintain line breaks e.g. \r or \n
Aug 9th, 2001 01:59
Jean-Bernard Valentaten, mur nolan,
As you should know, HTML-tags are not interpreted when nested inside a
textarea, but escape sequences (like \n) are. So when writing a
variable to the textarea.value simply insert \n for line break.
function writeToTextarea()
{
document.getElementById('theNameofyourTextarea').value
= 'Hello\n\nHow are you doing?'
}
That should work (in IE5+ and NN6 at least).
HTH