ZeroClipboardのサンプル



<input id="text" value="Sample Text">
<button id="btn">コピーする</button><br><br>
<input value="" placeholder="試しにここに貼り付ける">
var btn = document.getElementById("btn");
var text = document.getElementById("text");
var clip = new ZeroClipboard(btn);
clip.on("ready beforecopy", function() {
  btn.dataset.clipboardText = text.value;
});
try {
  if(!new ActiveXObject('ShockwaveFlash.ShockwaveFlash')) {
    btn.style.display = "none";
  }
}
catch(e) {
  if(navigator.mimeTypes ["application/x-shockwave-flash"] === undefined) {
    btn.style.display = "none";
  }
}