mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-13 20:53:09 +00:00
10 lines
320 B
JavaScript
10 lines
320 B
JavaScript
|
window.copyToClipboard = (str) => {
|
||
|
const textarea = document.createElement("textarea");
|
||
|
textarea.value = str;
|
||
|
textarea.style.position = "absolute";
|
||
|
textarea.style.opacity = "0";
|
||
|
document.body.appendChild(textarea);
|
||
|
textarea.select();
|
||
|
document.execCommand("copy");
|
||
|
document.body.removeChild(textarea);
|
||
|
};
|