I have a variable that receives text, I would like to insert a line break in this text after the 40th character in jQuery.
This line especially:
$(".chat").append('<li class="other"><div class="msg"><span>' + client + ':</span><p>' + msg + '</p><time>' + time.getHours() + ':' + time.getMinutes() + '</time></div></li>');
The variable msg
would need to receive a line break after the 40 character to fit within the div
horizontally, vertically the div
can grow as much as horizontally, it should maintain 200px or less. p>
DIV:
.msg {
background: white;
min-width: 50px;
max-width: 200px;
padding: 10px;
border-radius: 20px;
box-shadow: 0px 2px 0px rgba(0, 0, 0, 0.07);
}