JS点击复制文本
html
1 <p>邀请码:<i>999999999999</i> <span class="copys">复制</span> </p> 2 <textarea rows="" style="display:none" cols="">999999999999</textarea>
1 $(".copys").on("touchstart", function() { 2 $('textarea').select(); 3 document.execCommand("Copy"); 4 alert("复制成功!"); 5 });