UNPKG
everywherebible
Version:
latest (0.1.5)
0.1.5
A Bible app for slow connections
everywherebible.org
esvbible/esvbible.github.io
everywherebible
/
src
/
ui
/
copy-to-clipboard.js
10 lines
(9 loc)
•
248 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
export
default
text => {
const
el =
document
.
createElement
(
'textarea'
); el.
value
= text;
document
.
body
.
appendChild
(el); el.
focus
(); el.
setSelectionRange
(
0
, text.
length
);
document
.
execCommand
(
'copy'
);
document
.
body
.
removeChild
(el); };