$(function() { //复制 $(".redeem>a").click(function(){ var qrcodeLink = $(this).parent().children("div").children("span").text(); var clipboard = new Clipboard('.redeem>a', { text: function() { return qrcodeLink; } }); clipboard.on('success', function(e) { console.log("复制成功"); }); clipboard.on('error', function(e) { console.log("复制失败"); }); }) })