点击复制插件clipboard.js

<!DOCTYPE html>        
<html lang="en">        
<head>        
    <meta charset="UTF-8">        
    <title>点击复制插件clipboard.js</title>      
    <style type="text/css">  
    </style>       
</head>        
<body>  
    <span id="test">hello1</span>
    <button id="btn" data-clipboard-target="#test">点击复制</button>
    <button id="btn2" data-clipboard-text="hello2">点击复制2</button>
    <button id="btn3">点击复制3</button>
    <script src="https://cdn.bootcss.com/clipboard.js/1.7.1/clipboard.js"></script>
    <script type="text/javascript"> 
        new Clipboard('#btn'); 
        new Clipboard('#btn2'); 
        new Clipboard('#btn3', {
          text: function(trigger) {
            return 'hello3';
          }
        });
    </script>  
</body>        
</html>   


备注:欢迎加入web前端求职招聘qq群:668352707

posted @ 2018-01-16 13:42  徐同保  阅读(328)  评论(0编辑  收藏  举报