button copy javascript

JavaScript
var copyTextarea = document.getElementById("someTextAreaToCopy");
copyTextarea.select(); //select the text area
document.execCommand("copy"); //copy to clipboard<!DOCTYPE html>
<html>
 <head>
   <script>
     function paste() {
            var pasteText = document.querySelector("#text");
            pasteText.focus();
            document.execCommand("paste");

            pasteText.value = pasteText.value + pasteText.value;
        }
   </script>
  </head>
  <body>
    <input id="text">
    <button onclick="paste()">Paste</button>
   </body>
Source

Also in JavaScript: