粘贴版

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>constructor-node</title>
</head>




    <!-- 1. Define some markup -->
    <div id="btn" data-clipboard-text="1">
        <span>Copy</span>
    </div>
   <a href="" aria-label="sjdkf" class="btn-copy" id="aaaaaaaa">复制</href>
    <!-- 2. Include library -->
    <script src="clipboard.min.js"></script>


    <!-- 3. Instantiate clipboard by passing a HTML element -->
    <script>
   var clipboard = new Clipboard('.btn-copy', {
text: function (trigger) {

return trigger.getAttribute('aria-label');
}
});






clipboard.on('success', function (e) {
console.log(e);
});


clipboard.on('error', function (e) {
console.log(e);
});
    </script>
</body>

</html>


资源下载地址:压缩包(js+html)

http://download.csdn.net/detail/qing_mei_xiu/9920573


猜你喜欢

转载自blog.csdn.net/qing_mei_xiu/article/details/76650053