JS复制文本

首页 > 前端开发 > javascript 更新日期:2024-08-21 23:50:49

将以下内容放入任何点击事件。

var content = data.path;    // 要复制的文本内容
var $temp = $("<textarea>");
$("body").append($temp);
$temp.val(content).select();
document.execCommand("copy");
$temp.remove();
layer.msg("已复制到剪贴板")


标题导航