Written by Malappa Kuruva on August 20, 2014 in JavaScript

Copy Text from Textbox with Button Click [JavaScript]


Get our Latest updates delivered to your mailbox!

We are back with yet another programming tutorial.

This is a beginner’s Javascript code, that you have to try if you’ve started learning JavaScript lately. In this program, we will create two text boxes and a button, in which whatever you enter on to the first textbox will be copied onto the second textbox if you click on the button. Sounds fair?

These kind of applications appears really basic, but we’ll be using these applications while designing the text editors a lot. You can consider it as a basic practical Javascript application.

So, lets check out how this code works.

Download Source Code

Copy text</title>
<h2>Copy text from different field</h2>
<input type="text" style="color: #FE0080;background-color: #B9C299" id="sorcefiled" value="Hai
<input type="text" style="color: #FE0080;background-color: #B9C299" id="targetfiled">
<button style="background-color: #E799A3" onclick="document.getElementById('targetfiled').value =
document.getElementById('sorcefiled').value">Click to Copy Text





output image

{ 0 comments… add one now }

Leave a Comment

Previous post:

Next post: