解决类名相同的问题
This commit is contained in:
浪子
2025-06-11 17:15:57 +08:00
parent 6f37575943
commit 0ed7e7b5e8
3 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ document.addEventListener('DOMContentLoaded', function() {
});
}
// 给所有复制链接添加点击事件
document.querySelectorAll('.text').forEach(link => {
document.querySelectorAll('.copy').forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
const textToCopy = this.getAttribute('data-copy') || this.textContent;