Skip to content

Instantly share code, notes, and snippets.

@appforest
Created September 3, 2013 19:18
Show Gist options
  • Save appforest/6428331 to your computer and use it in GitHub Desktop.
Save appforest/6428331 to your computer and use it in GitHub Desktop.
Copy to Clipboard
function copyToClipboard(){
var textoCopiable = document.body.createTextRange();
textoCopiable.moveToElementText(document.getElementById("toCopyFrom"));
textoCopiable.select();
textoCopiable.execCommand("Copy");
textoCopiable.execCommand("unselect");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment