<div style="height:1px; width:1px; overflow:hidden; position:absolute;left:-2px;">
<input type="text" id="copybox" value="" />
</div>
js:
$("#copybox").val("要复制的内容");
var str = $("#copybox");
str.select();
document.execCommand("Copy");
<div style="height:1px; width:1px; overflow:hidden; position:absolute;left:-2px;">
<input type="text" id="copybox" value="" />
</div>
js:
$("#copybox").val("要复制的内容");
var str = $("#copybox");
str.select();
document.execCommand("Copy");