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-08-03 12:04:07 +02:00

11 lines
268 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