标签搜索

javascript 复制粘贴

sunshine
2023-07-26 / 0 评论 / 63 阅读
温馨提示:
本文最后更新于2023年07月26日,已超过450天没有更新,若内容或图片失效,请留言反馈。
<script>
      function sun_copy() {
        var coupon_code_dom = document.getElementById("coupon-code")
        var show_copy = document.getElementById("sunshine-copy")
        var coupon_code = coupon_code_dom.innerText
        var inp = document.createElement("input")
        document.body.appendChild(inp)
        inp.value = coupon_code
        inp.select()
        document.execCommand("copy", false)
        inp.remove()
        show_copy.innerText = 'Copied'
      }

</script>
感觉很棒,欢迎点赞 OR 打赏~
0
分享到:

评论 (0)

取消