ClipboardJS实现点击复制功能
作者:互联网
- <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);
});
标签:function,console,clipboard,点击,复制,ClipboardJS,foo,log 来源: https://www.cnblogs.com/webqian/p/10520140.html