function copyTextToClipboard(text) {  
  var textArea = document.createElement("textarea");   
  textArea.style.background = 'transparent';  
  textArea.value = text;  
  document.body.appendChild(textArea);  
  textArea.select();  
  try {    
    var successful = document.execCommand('copy');    
    var msg = successful ? 'successful' : 'unsuccessful';          
  } catch (err) {  
  console.log('Oops, unable to copy');  
  }  
 document.body.removeChild(textArea);}
posted on   芝麻的西瓜  阅读(248)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示