This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
FunctionProject/website/utils/copyToClipboard.js
2020-05-01 21:01:03 +02:00

10 lines
285 B
JavaScript

function copyToClipboard(text) {
const element = document.createElement('textarea');
element.value = text;
document.body.appendChild(element);
element.select();
document.execCommand('copy');
document.body.removeChild(element);
}
export default copyToClipboard;