jq 点击文本复制
<a title="<?= $u['did']; ?>" id="article">
<div class="td-text" id="copy-text"><?= $u['did']; ?></div>
</a>
$(document).on('click', '#article', function() {
const range = document.createRange();
range.selectNode($(this)[0]);//点击选择的文本
const selection = window.getSelection();
if (selection.rangeCount > 0) selection.removeAllRanges();
selection.addRange(range);
document.execCommand('copy');
});

浙公网安备 33010602011771号