[Recording] Using Jquery implemented within a dynamic wrap text textarea

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 &#10;or&#13;

var messageInfo =  messageInfo + time + '   ' + msg.role+"&#10;"+msg.content +"&#10;";
$('#messageInfo').html(messageInfo);

 

Reference Links: https://blog.csdn.net/qq_16371909/article/details/79697780

Hoping to help you.

 

Guess you like

Origin www.cnblogs.com/wbl001/p/11423577.html