首页 > 移动平台 > 详细

移动端 点击 复制到剪贴版

时间:2019-12-20 12:14:18      阅读:85      评论:0      收藏:0      [点我收藏+]

$(‘.copy‘).click(function(){
  var text=$(this).prev().children().text()
  const input = document.createElement(‘input‘);
  input.setAttribute(‘readonly‘,‘readonly‘);
  input.setAttribute(‘value‘,text);
  document.body.appendChild(input);
  input.setSelectionRange(0, 9999);
  if (document.execCommand(‘copy‘)) {
    input.select()
    document.execCommand(‘copy‘);
  }
  document.body.removeChild(input);
  $(‘.clipBoard_notice‘).css(‘display‘,‘block‘)
  clearTimeout(this.delay)
  this.delay=setTimeout(function(){
    $(‘.clipBoard_notice‘).css(‘display‘,‘none‘)
  },2000)
})

移动端 点击 复制到剪贴版

原文:https://www.cnblogs.com/luoshida/p/12071867.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!