display newline CR within <textarea>
Posted on 2009-04-03
a user can enter a text into a textarea. the text could have line breaks.
after the insert the text is stored into a database with \n as line breaks.
This is my
a lot of
now, when the user likes to edit the text he entered before the line breaks are not display
within the textarea. when i output the text the text look like:
This is my\nText \nwith \na lot of \nnew lines
How can i display these newlines within the textarea.
this site do the same when i edit my comment. but how does it work?