Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

InnerHTML not working with textarea

 
Shashank Anand
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a form that contains two textareas and a button. My onclick="display()" function goes like this:

On clicking the button, contents of first textarea should be copied to second textarea.
But it seems the innerHTML function is not working as nothing is displayed in the textarea. If I just put myDiv.innerHTML="hello"; it is displayed.
Without using innerHTML, if I just type in the first textarea, it is copied to the second textarea.

Please help me as I want to predefine elements that should go into the textarea using javascript.
Shashank.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64633
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
textarea has no innerHTML property. Try settings its value.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic