Can't update textarea with javascript after writing to it manually
I had this same problem. When HTML is parsing to DOM object, content of textarea
is innetHTML
of <textarea>
<textarea cols="10" rows="10">Content of textarea</textarea>
Values document.getElementByTagName('textarea').innerHTML
and document.getElementByTagName('textarea').value
returns this same value Content of textarea
But after loading DOM object, changing innerHTML
value doesn't change content of textarea
box. A solution to change it is modifying value
field.
document.getElementByTagName('textarea').value="New content of textarea";
or in jquery
$("textarea").val("New content of textarea");
.value and .innerHTML seemed to fix the problem