Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Line Breaks In TextArea

12:12 am on May 27, 2007 (gmt 0)

Full Member

10+ Year Member

joined:June 16, 2004
votes: 0

I am trying to dynamically show the user textarea input through javascript in a preview panel, however my function only removes one instance of the '\n' and replaces it with '<br>'. I need to remove all instances of the '/n' chars.

var text=comments.value;
textarea=text.replace('\n', '<br/>');

[edited by: BlackRaven at 12:20 am (utc) on May 27, 2007]