signed

QiShunwang

“诚信为本、客户至上”

复制到剪切板

2021/6/24 17:27:44   来源:

html

      <div class="cl copye_div">
        <div class="left copybtn" id="copyqq" data-clipboard-action="copy" data-clipboard-target="div"
          data-clipboard-text="2305731027">

        </div>
        <div class="left copytitle">
          QQ:
        </div>
        <div class="left" id="qq">
          2305731027
        </div>
      </div>

地址链接

https://clipboardjs.com/
  <script src="./js/jquery-3.5.1.min.js"></script>
  <script src="./js/clipboard.min.js"></script>

JS:

 $(document).ready(function () {
    var clipboard = new ClipboardJS('#copyqq');

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

      e.clearSelection();
    });

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


    var clipboard = new ClipboardJS('#copytelegram');

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

      e.clearSelection();
    });

    clipboard.on('error', function (e) {
      console.log(e)
    });
    var clipboard = new ClipboardJS('#copyskype');

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

      e.clearSelection();
    });

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