作者:英雄泪 | 来源:互联网 | 2023-10-16 15:42
js点击复制文本$(.copyBttn).click(function(){copy(linkUrls,已复制)linkUrls为要复制元素的ID})functioncopy(i
js 点击复制文本
$('.copyBttn').click(function () {copy('linkUrls','已复制')// linkUrls 为要复制元素的ID})function copy(id, text) {const range = document.createRange();range.selectNode(document.getElementById(id));const selection = window.getSelection();if (selection.rangeCount > 0) selection.removeAllRanges();selection.addRange(range);document.execCommand('copy');alert(text);}