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
You can use \r
or \n
for this.
Additionally HTML also supports \t
to apply tab between two words.
document.querySelector("#my_textarea1").value = "foo\rbar"
document.querySelector("#my_textarea2").value = "foo\nbar"
document.querySelector("#my_textarea3").value = "foo\tbar"
New line using "\r" :
New line using "\n" :
Tab between tow words using "\t" :