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         });
 
 
 
 

猜你喜欢

转载自www.cnblogs.com/hasubasora/p/9912632.html