<input class="copy_input" type="text" value="123" disabled> <button class="copy_button">复制</button> <input class="hide" type="text" >
<script> $(function () { // 点击复制 $(".copy_button").click(function () { var text = $(this).prev().val(); $(this).next().val(text); $(this).next().select(); document.execCommand("copy"); alert("复制成功"); }); }); </script>
本文属原创,转载请注明原文:https://zhimatong.com/jiaocheng/798.html
为保证教程的实用性及扩大知识面覆盖,如果您有相似问题而未解决,可联系在线客服免费技术支持。