mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-07-26 16:49:37 +02:00
13 lines
315 B
JavaScript
13 lines
315 B
JavaScript
|
const copyToClipboard = (text) => {
|
||
|
const input = document.createElement('textarea');
|
||
|
input.innerHTML = text;
|
||
|
document.body.appendChild(input);
|
||
|
input.select();
|
||
|
const result = document.execCommand('copy');
|
||
|
document.body.removeChild(input);
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
export {
|
||
|
copyToClipboard
|
||
|
}
|