| Total Complexity | 1 |
| Complexity/F | 1 |
| Lines of Code | 10 |
| Function Count | 1 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 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 | } |