Answers for "js copy function methods"

3

javascript copy to clipboard

<head><script>
function copyToCliBoard() {
  var copyText = document.getElementById("myInput");
  copyText.select();
  copyText.setSelectionRange(0, 99999); /* For mobile devices */
  document.execCommand("copy");
  alert("Copied the text: " + copyText.value);
}
</script></head>

<body>
<input type="text" value="Hello World" id="myInput">
<button onclick="copyToCliBoard()">Copy text</button>
</body>
Posted by: Guest on March-15-2021
0

copywithin javascript

// Copy the first two array elements to the last two array elements:
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.copyWithin(2, 0);
Posted by: Guest on July-03-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language