Skip to content

Instantly share code, notes, and snippets.

@wtfaremyinitials
Created April 23, 2015 19:00
Show Gist options
  • Save wtfaremyinitials/1b16346f0458dd6e8dda to your computer and use it in GitHub Desktop.
Save wtfaremyinitials/1b16346f0458dd6e8dda to your computer and use it in GitHub Desktop.
Javascript copy to clipboard
function copytext(text) {
var textField = document.createElement('textarea');
textField.innerText = text;
document.body.appendChild(textField);
textField.select();
document.execCommand('copy');
textField.remove();
}
// credit to reddit.com/u/liamht
@yairEO
Copy link

yairEO commented Jun 23, 2016

Doesn't work (Firefox 48 /Win7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment