Created
April 15, 2016 08:22
-
-
Save culttm/60e8b105c404c1082f9b5ae6739754d6 to your computer and use it in GitHub Desktop.
Simple clipboard function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function clip(text) { | |
var copyElement = document.createElement('input'); | |
copyElement.setAttribute('type', 'text'); | |
copyElement.setAttribute('value', text); | |
copyElement = document.body.appendChild(copyElement); | |
copyElement.select(); | |
document.execCommand('copy'); | |
copyElement.remove(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment