Ex : document.write("\n");
I want to print that \n in my <textarea>.
Ex : document.write("\n");
I want to print that \n in my <textarea>.
The \ starts an escape sequence (for a new line), so you have to escape it to get a literal slash.
"\\n"
For a textarea, you just write that between <textarea …> and </textarea> (if you are writing the whole thing with document.write or reference_to_textarea.value = "\\n" if you are setting it after the element exists in the DOM.