HTML: <input type="hidden" id="content" value="复制的内容"/> <input type="button" id="copyUrl" value="请点击我复制"/> JS: var clipboard2 = new ClipboardJS('#copyUrl', { text: function() { return $("#content").val(); } }); clipboard2.on('success', function(e) { console.log("已复制到剪贴板!"); }); clipboard2.on('error', function (e) { });