js-复制到粘贴板 肖恩分享 2021-12-20 161 阅读1分钟 const inputItem = document.getElementById("copyInputId"); inputItem.setAttribute("value", val); inputItem.select(); // 选择对象 document.execCommand("Copy"); alert("复制成功");