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()