【发布时间】:2022-01-16 17:48:02
【问题描述】:
copyURL1(){
const links = document.getElementsByClassName("copylink" );`enter code here`
const range = document.createRange();
range.selectNode(links);
const selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
const successful = document.execCommand('copy');
}
我已经编写了从元素复制文本的代码,但它显示了错误 “HTMLCollectionOf”类型的参数不能分配给“Node”类型的参数。 “HTMLCollectionOf”类型缺少“Node”类型的以下属性:baseURI、childNodes、firstChild、isConnected 和 46 个以上。
【问题讨论】:
标签: javascript html css angular typescript