function copyText() { var ctx = document.createElement("input"); var content = "需要复制的内容"; ctx.setAttribute("value", content); document.body.appendChild(ctx); ctx.select(); document.execCommand("copy"); document.body.removeChild(ctx); }
本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。
我来说两句