We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 34b0390 commit 642bc63Copy full SHA for 642bc63
dom/copy_text.js
@@ -0,0 +1,17 @@
1
+function copyToClipboard() {
2
+ // Get the data to copy
3
+ var data = document.getElementById("dataToCopy").innerText;
4
+
5
+ // Create a temporary textarea element
6
+ var tempTextarea = document.createElement("textarea");
7
+ tempTextarea.value = data;
8
+ document.body.appendChild(tempTextarea);
9
10
+ // Select the text and copy it to clipboard
11
+ tempTextarea.select();
12
+ document.execCommand("copy");
13
14
+ // Remove the temporary element
15
+ document.body.removeChild(tempTextarea);
16
+ }
17
0 commit comments