Halloween
some text is entered into textarea. Next is a button with a js-function, when clicked, the text is processed and returned to the textarea. The problem is that the text is returned without line breaks. How to save line breaks?
For example, such a function. Everything works, but the result is returned in one continuous line.
function addcomma(comma) { var str = document.getElementById('comma').value.replace('\r', ''); var result = str.split('\n'); var i = 0; while (i < result.length) { document.getElementById('comma').value = result[i] + ','; i++; } }