• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

how to copy a textbox answer to a textarea using javascript

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • 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
  • 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>


-----------------------------------------
 
I'm THIS CLOSE to ruling the world! Right after reading this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic