• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to copy a textbox answer to a textarea using javascript

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I'm facing a problem here. I want to copy the answer in a textbox to a textarea using a javascript function.
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>


-----------------------------------------
 
reply
    Bookmark Topic Watch Topic
  • New Topic