📌  相关文章
📜  使用 javascript 代码示例复制到剪贴板

📅  最后修改于: 2022-03-11 15:03:38.359000             🧑  作者: Mango

代码示例4
function handleCopyTextFromParagraph() {
  const cb = navigator.clipboard;
  const paragraph = document.querySelector('p');
  cb.writeText(paragraph.innerText).then(() => alert('Text copied'));
}