no, just write your code with '\ n' and thatβs enough. since getting text from textarea means exporting to a text form that can be presented as a file or something else, and then from https://en.wikipedia.org/wiki/Newline
When writing to a file, a node device, or a / fifo socket in text mode, '\ n' is transparently translated into a sequential new line sequence, the system used, which can be longer than one character. When reading in the text mode, a new sequence of lines of a new line will be translated to "\ n". In binary mode, translation is not performed, and the internal representation created by '\ n' is output directly.
it really depends on what you want to do with it. if you send it back to your server, then it is up to you if you want to export it as a file and then to the OS. but, as a rule, it is almost always safe to use "\ n" since it was more common and generally accepted.
$(function(){ var $text = $("#text"); $text.val( $text.val() + "Hello \nThis is '\\r' a \r" +
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <textarea id="text" rows="7" cols="37"> Hey<br>there\n </textarea> <br> <button id="wonder">wonder</button>
source share