I store a text in my database as
$dataStorage = "This is my short string.\n\nThank you."
When i fetch the string from database and display in input box or text area, It appears just as it is stored in the database (i.e with the new break line" as below
This is a short string.
Thank you.
Now, i am trying to display the text in div. The text appears but the new lines do not show. So it appears like
This is a short string.Thank you
How can i fix this using jquery
HTML
<div class="chat-content rounded" id="msg">
</div>
JS
//result is the string from the database
$('#msg').val(result);
elements?](https://stackoverflow.com/questions/784539/how-do-i-replace-all-line-breaks-in-a-string-with-br-elements) – Mohammad Jan 29 '21 at 13:20