Completed
Push — master ( bda088...431d08 )
by Sander
01:09
created

copyText.js ➔ copyText   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 10
rs 9.4285
1
function copyText(text) {
2
    var txtToCopy = document.createElement('input');
3
    txtToCopy.style.left = '-300px';
4
    txtToCopy.style.position = 'absolute';
5
    txtToCopy.value = text;
6
    document.body.appendChild(txtToCopy);
7
    txtToCopy.select();
8
    document.execCommand('copy');
9
    txtToCopy.parentNode.removeChild(txtToCopy);
10
}