background:
Recently doing when it came to the front end of a situation, you need to enter the dynamic content using js to textarea,
For example, real-time chat feature, users need to send a message each time A separate line.
problem:
Based on past experience, that with $ ( '# textArea') html (hello + '<br>');. The way, but the test time does not work well.
Solution:
Use html line breaks
or
var messageInfo = messageInfo + time + ' ' + msg.role+"
"+msg.content +"
"; $('#messageInfo').html(messageInfo);
Reference Links: https://blog.csdn.net/qq_16371909/article/details/79697780
Hoping to help you.