I’m editing a <textarea> with JavaScript. The problem is that when I make line breaks in it, they won’t display. How can I do this?
I’m getting the value to write a function, but it won’t give line breaks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The problem comes from the fact that line breaks (
\n\r?) are not the same as HTML<br/>tags:Since many of the comments and my own experience have shown me that this
<br>solution is not working as expected, here is an example of how to append a new line to atextareausing ‘\r\n’: