Skip to content

Instantly share code, notes, and snippets.

@marcab
Created May 29, 2012 21:53
Show Gist options
  • Save marcab/2831018 to your computer and use it in GitHub Desktop.
Save marcab/2831018 to your computer and use it in GitHub Desktop.
document.getElementsByClassName("commit-ref from")[0].onclick = function(e) {
var sel = window.getSelection();
var range = document.createRange();
sel.removeAllRanges();
range.selectNodeContents(e.target);
sel.addRange(range);
document.execCommand('copy');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment