$('#btn').click(function(e){ let url = e.currentTarget.dataset.url; $("body").after("<textarea cols='1' rows='1' id='copyContent'>" + url + "</textarea>"); let link = document.getElementById("copyContent"); link.select(); // 选择对象 document.execCommand("Copy"); $("#copyContent").remove(); alert('复制成功'); })
站点统计
留言咨询