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);
移动端、pc端通用点击复制
猜你喜欢
转载自www.cnblogs.com/datiangou/p/10207920.html
今日推荐
周排行