📌  相关文章
📜  js 复制到剪贴板 - Javascript 代码示例

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

代码示例6
function textToClipboard (text) {
    var dummy = document.createElement("textarea");
    document.body.appendChild(dummy);
    dummy.value = text;
    dummy.select();
    document.execCommand("copy");
    document.body.removeChild(dummy);
}