Change text displayed in HTML textarea using JavaScript

How do I change the text displayed in an HTML textarea using JavaScript?  Setting either value or defaultValue appears to change the attribute in the DOM but not the display. Please see code snippet.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
I believe you have to use 'innerHTML' to change the text in between the opening and closing tags in 'textarea'.
anAppBuilderAuthor Commented:
Thank you, Dave.  Unfortunately that does not work.  Please see my new test snippet.  It does not work in IE, Edge, or Chrome.  I did not test any other browsers.

Dave BaldwinFixer of ProblemsCommented:
You're trying way too hard.  This works.
<!doctype html>
<html id="myHTML">
	function testTextareaValue() {
		var elt = document.getElementById("myText");
		elt.innerHTML = "This is the changed text";
	<meta charset='UTF-8'>

<body id = 'myBody'>
	<form id = 'myForm' >
	<textarea id='myText' rows='20' cols='120'>Initial text</textarea>
	<button type='button' value = 'test' onclick='testTextareaValue()'>Test Text Area</button>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anAppBuilderAuthor Commented:
Thank you, Dave,

I think it is always valuable to determine why the solution that didn't work failed.  In this case, the snippet I posted appeared to differ from the solution only by doing several debug writes. And with some testing I determined that the debug writes were causing the failure. Any writes to the body element of the form "body.innerHTML += ..." prevent the update to the text in the TextArea.  And interestingly doing an "elt.focus();" back to the TextArea after the body write(s) does not prevent the failure.  My bad--should have used console.log for the debug writes.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.