This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes how to copy a textbox answer to a textarea using javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to copy a textbox answer to a textarea using javascript" Watch "how to copy a textbox answer to a textarea using javascript" New topic
Author

how to copy a textbox answer to a textarea using javascript

Christian Nash
Ranch Hand

Joined: Jan 17, 2006
Posts: 107
Hi all,

I'm facing a problem here. I want to copy the answer in a textbox to a textarea using a javascript function.


- Christian
Shyam kumar
Ranch Hand

Joined: May 21, 2006
Posts: 146
Hi,

You can do this by first obtaining the id's of the textbox and textarea tags and then assigning the value attribute of the textarea to the text box. Please see the script below:

--------------------------------------------

function transfer(){
document.getElementById("text1").value=document.getElementById("textarea1").value

}
<input type="text" id="text1" name="textbox" value="Textbox"/><p>
<textarea id="textarea1">TextArea here!!! </textarea>
<button onclck="transfer()">Submit</button>


-----------------------------------------
 
Consider Paul's rocket mass heater.
 
subject: how to copy a textbox answer to a textarea using javascript
 
Similar Threads
How to copy HTML page content to clipborad
issue with a textbox on firefox.
How to
how to avoid copy pasting characters above the set limit in a text area.
Copy-to-clipboard