Hmm, after some testing, it seems that it should work the way you want it, so I'm not sure why it is not, you can try using the following instead and see if it solves your problem:
console.warn("Before set, value is " + document.getElementById('myTextArea').value); document.getElementById('myTextArea').firstChild.textContent = 'OMGWTFBBQ'; console.warn("After set, value is " + document.getElementById('myTextArea').value);
If this does not work for you, then something about your page is very strange :)
Try something extremely simple, like the following:
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script> $(function(){ console.warn("Before set, value is " + document.getElementById('myTextArea').value); document.getElementById('myTextArea').firstChild.textContent = 'OMGWTFBBQ'; console.warn("After set, value is " + document.getElementById('myTextArea').value); }); </script> </head> <body> <textarea id="myTextArea">hey</textarea> </body> </html>
if this works, then the browser is not to blame, and you need to find the problem in your code. If this does not work, you can blame the browser :)
source share