- <script src="//lib.baomitu.com/clipboard.js/1.7.1/clipboard.min.js"></script>
-
<!-- Target -->
<input id="foo" value="https://github.com/zenorocha/clipboard.js.git">
<!-- Trigger -->
<button class="btn" data-clipboard-target="#foo">
Copy to clipboard
</button> -
var clipboard = new ClipboardJS('#foo');
clipboard.on('success', function(e) {
console.log(e);
});
clipboard.on('error', function(e) {
console.log(e);
});