title: Set text in <textarea>, including newlines
body: <p>I want to set the text in a <code>&lt;textarea&gt;</code> from a js-function; I'm simply setting the <code>innerText</code>-attribute to a new value. The text is multiline and should be displayed as such. However, newlines are dropped by the browser and the entire text is displayed as one line:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>document.getElementById("my_textarea1").innerText = "foo\nbar"; // displayed as "foobar"
  
  document.getElementById("my_textarea2").innerText = "foo\
      bar"; // displayed as "foobar"
  
  document.getElementById("my_textarea3").innerText = `foo\
      bar`; // again, "foobar"</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;textarea id="my_textarea1"&gt;&lt;/textarea&gt;
  &lt;textarea id="my_textarea2"&gt;&lt;/textarea&gt;
  &lt;textarea id="my_textarea3"&gt;&lt;/textarea&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Is there a way to preserve newlines when setting the text in a <code>&lt;textarea&gt;</code>?</p>