const spanText = document.getElementById('Id')
const selection = window.getSelection()
selection.removeAllRanges()
const range = document.createRange()
range.selectNodeContents(spanText)
selection.addRange(range)
document.execCommand("copy")
selection.removeAllRanges()
js 点击复制
最新推荐文章于 2024-07-20 23:54:17 发布