I want to set the text in a from a js-function; I\'m simply setting the innerText-attribute to a new value. The text is multiline
innerText
Use area.innerHTML instead, innerText property strips off the new line character
var area = document.getElementById("my_textarea"); area.innerHTML = "foo\nbar";