点击复制


function copyArticle(event){
    const range = document.createRange();
    range.selectNode(document.getElementById('dd'));
    const selection = window.getSelection();
    if(selection.rangeCount > 0) selection.removeAllRanges();
    selection.addRange(range);
    document.execCommand('copy');
    $(this).text("已复制");
    setTimeout(function(){$("#cp1").text("点击复制")},1000);
}
document.getElementById('cp1').addEventListener('click', copyArticle, false);

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2019-05-30
  • 2021-11-26
  • 2022-12-23
  • 2021-11-23
猜你喜欢
  • 2021-11-09
  • 2022-12-23
  • 2021-10-01
  • 2021-11-23
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案