Skip to content

Instantly share code, notes, and snippets.

@wangwen1220
Forked from hallvors/clipboard.js
Created March 6, 2014 14:56
Show Gist options
  • Save wangwen1220/9391499 to your computer and use it in GitHub Desktop.
Save wangwen1220/9391499 to your computer and use it in GitHub Desktop.
var btn = document.getElementById("copy-button");
btn.addEventListener("click", clickHandler, false);
function clickHandler(e) {
e.target.dispatchEvent(new ClipboardEvent("copy", {dataType:'text/plain', data:'Simulated copy. Yay!'}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment