简体   繁体   中英

how to move left side text into right side text field

I have two text field in front of each other. when i write some text in left side text field. The issue is how can i move left side text into right side text field through button

You can view the text field design https://i.stack.imgur.com/jj4Ju.png

If I understood your question correctly you want just copy the content of the left textarea to the right one, right? Here is a solution in plain js:

var
    taLeft = document.getElementsByClassName('left')[0],
    taRight = document.getElementsByClassName('right')[0],
    btn = document.getElementsByClassName('btn')[0];

    btn.addEventListener('click', function() {
       taRight.value = taLeft.value;
    })

Here is working demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM