Clipboard.js 实现点击复制
clipboard.js中文网:http://www.clipboardjs.cn 复制.zip
<a class="btn">Copy</a> <div id="aa">hello</div> <script src="../dist/clipboard.min.js"></script> <script> var clipboard = new ClipboardJS('.btn', { target: function() { return document.querySelector('#aa'); } }); clipboard.on('success', function(e) { console.log(e); }); clipboard.on('error', function(e) { console.log(e); }); </script>
|
|
|
|
|
|
精彩评论 (0)