Skip to content

Instantly share code, notes, and snippets.

@sharapeco
Created July 6, 2018 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sharapeco/1eea2d1233a653b7a390a99c5ad84def to your computer and use it in GitHub Desktop.
Save sharapeco/1eea2d1233a653b7a390a99c5ad84def to your computer and use it in GitHub Desktop.
pbcopy.js
function pbcopy(s,d,e,l,a){
d=document;a="appendChild";e=d.createElement("div");e[a](d.createElement("pre")).textContent=s;
l=e.style;l.position="fixed";l.left="-100%";d.body[a](e);d.getSelection().selectAllChildren(e);
l=d.execCommand("copy");d.body.removeChild(e);return l}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment