Advertisement
Guest User

COPY TO CLIPBOARD

a guest
Mar 25th, 2019
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <input type="text" value="TEXT" id="myInput">
  6. <button onclick="myFunction()">Copy text</button>
  7.  
  8. <script>
  9. function myFunction() {
  10. var copyText = document.getElementById("myInput");
  11. copyText.select();
  12. document.execCommand("copy");
  13. alert("Copied the text: " + copyText.value);
  14. }
  15. </script>
  16.  
  17. </body>
  18. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement