This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes InnerHTML not working with textarea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "InnerHTML not working with textarea" Watch "InnerHTML not working with textarea" New topic

InnerHTML not working with textarea

Shashank Anand

Joined: Oct 30, 2008
Posts: 26
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.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60773

textarea has no innerHTML property. Try settings its value.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: InnerHTML not working with textarea
Similar Threads
Help me to have a sortable table in my html profile!
make array of hidden fields
problem with javascript
cant display the table
spaces while populating using s:iterator