Answers for "how to copy clipboard"

11

copy link to clipboard

function copy() {
  var copyText = document.querySelector("#input");
  copyText.select();
  document.execCommand("copy");
}

document.querySelector("#copy").addEventListener("click", copy);
Posted by: Guest on September-17-2019
1

copy link to clipboard

document.getElementById("copy-text").onclick = function() {
  this.select();
  document.execCommand('copy');
  alert(window.getSelection().toString());
}
Posted by: Guest on May-13-2020
0

copy to clipboard

navigator.clipboard.writeText('Text To Copy');
Posted by: Guest on May-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language