Monday, 1 November 2021

How TO - Copy Textarea to Clipboard without jquery

 How TO - Copy Textarea to Clipboard without jquery


<script>

function copy() {

  let textarea = document.getElementById("textarea");

  textarea.select();

  document.execCommand("copy");

}

</script>

<textarea rows=40 cols=100% id=textarea>Dedicated Servers

Get all the raw performance of the server for your resource-intensive websites & applications


Choose from SSD or HDD plans High-memory servers New Generation Processors Get started within minutes

Starts at Rs.8,666.60 /mo

more details visit https://sakhihosting.in/dedicated-servers.php</textarea>

<br>

<button onclick="copy()">Copy</button>


Example :

No comments:

Post a Comment