<button id="copy">复制</button>
<input id="content" value="放假我诶费劲哦我IE房间">
<script src="jquery脚本"></script>
<script>
//jQuery方式
$("#copy").click(function () {
var text = $("#content");
text.select();
document.execCommand("copy");
});
//js方式
$("#copy").click(function () {
var text = document.getElementById('content');
text.select();
document.execCommand("copy");
});
</script>
jQuery或Js实现文字内容的复制功能(亲测有效)
最新推荐文章于 2023-08-10 11:48:14 发布