Chile,
<textarea></textarea>
<textarea id='target'></textarea>
<button id='pasteButton'>Paste</button>
<script>
function copySelected(target) {
if (target) {
const selectedText = document.getSelection().toString();
target.value = selectedText;
}
};
pasteButton.addEventListener('click', () => copySelected(target));
</script>