I want to create a copy-paste event from the console. Here is what I did till now:
var body = document.getElementsByTagName('body')[0];
var copybutton = document.createElement('button');
copybutton.id = 'copybutton';
copybutton.innerHTML = 'Copy';
body.appendChild(copybutton);
var pastebutton = document.createElement('button');
pastebutton.id = 'pastebutton';
pastebutton.innerHTML = 'Paste';
body.appendChild(pastebutton);
var copyarea = document.createElement('textarea');
copyarea.id = 'copyArea';
copyarea.innerHTML = 'text1';
body.appendChild(copyarea);
var pastearea = document.createElement('textarea');
pastearea.id = 'pasteArea';
pastearea.innerHTML = '';
body.appendChild(pastearea);
// Here will be the function codes
document.getElementById('copybutton');
document.getElementById('pastebutton');
I created 2 text areas and 2 buttons. What I do want to do is, I want to copy the text inside of the text1 area with clicking the copy button and paste it inside of the '' area with clicking the paste button.