Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <input type="text" value="TEXT" id="myInput">
- <button onclick="myFunction()">Copy text</button>
- <script>
- function myFunction() {
- var copyText = document.getElementById("myInput");
- copyText.select();
- document.execCommand("copy");
- alert("Copied the text: " + copyText.value);
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement