<input id="foo" type="text" value="https://chupai.github.io/">
<button class="btn" data-clipboard-target="#foo">copy</button>
body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
}
console.clear();

const clipboard = new ClipboardJS('.btn');

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js